Skip to content

Commit c7126fe

Browse files
committed
feat: add "across all versions" subtitle to weekly downloads section
Clarifies that download stats are aggregated at the package level, not per version. Adds a subtitle prop to CollapsibleSection and uses it in the downloads sidebar to reduce user confusion. Closes #1670
1 parent e5ccbff commit c7126fe

9 files changed

Lines changed: 31 additions & 10 deletions

File tree

app/components/CollapsibleSection.vue

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { LinkBase } from '#components'
44
55
interface Props {
66
title: string
7+
subtitle?: string
78
isLoading?: boolean
89
headingLevel?: `h${number}`
910
id: string
@@ -81,7 +82,8 @@ useHead({
8182
<div class="flex items-center justify-between mb-3 px-1">
8283
<component
8384
:is="headingLevel"
84-
class="group text-xs text-fg-subtle uppercase tracking-wider flex items-center gap-2"
85+
class="group text-xs text-fg-subtle uppercase tracking-wider flex gap-2"
86+
:class="subtitle ? 'items-start' : 'items-center'"
8587
>
8688
<button
8789
:id="buttonId"
@@ -101,9 +103,14 @@ useHead({
101103
/>
102104
</button>
103105

104-
<LinkBase :to="`#${id}`">
105-
{{ title }}
106-
</LinkBase>
106+
<div>
107+
<LinkBase :to="`#${id}`">
108+
{{ title }}
109+
</LinkBase>
110+
<span v-if="subtitle" class="block text-2xs normal-case tracking-normal opacity-70">{{
111+
subtitle
112+
}}</span>
113+
</div>
107114
</component>
108115

109116
<!-- Actions slot for buttons or other elements -->

app/components/Package/WeeklyDownloadStats.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ const config = computed<VueUiSparklineConfig>(() => {
281281

282282
<template>
283283
<div class="space-y-8">
284-
<CollapsibleSection id="downloads" :title="$t('package.downloads.title')">
284+
<CollapsibleSection
285+
id="downloads"
286+
:title="$t('package.downloads.title')"
287+
:subtitle="$t('package.downloads.subtitle')"
288+
>
285289
<template #actions>
286290
<ButtonBase
287291
v-if="hasWeeklyDownloads"

i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@
440440
},
441441
"downloads": {
442442
"title": "Weekly Downloads",
443-
"community_distribution": "View community adoption distribution"
443+
"community_distribution": "View community adoption distribution",
444+
"subtitle": "Across all versions"
444445
},
445446
"install_scripts": {
446447
"title": "Install Scripts",

i18n/locales/fr-FR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,8 @@
415415
},
416416
"downloads": {
417417
"title": "Téléchargements hebdo.",
418-
"community_distribution": "Voir la distribution des versions téléchargées par la communauté"
418+
"community_distribution": "Voir la distribution des versions téléchargées par la communauté",
419+
"subtitle": "Toutes versions confondues"
419420
},
420421
"install_scripts": {
421422
"title": "Scripts d'installation",

i18n/schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,9 @@
13261326
},
13271327
"community_distribution": {
13281328
"type": "string"
1329+
},
1330+
"subtitle": {
1331+
"type": "string"
13291332
}
13301333
},
13311334
"additionalProperties": false

lunaria/files/en-GB.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@
439439
},
440440
"downloads": {
441441
"title": "Weekly Downloads",
442-
"community_distribution": "View community adoption distribution"
442+
"community_distribution": "View community adoption distribution",
443+
"subtitle": "Across all versions"
443444
},
444445
"install_scripts": {
445446
"title": "Install Scripts",

lunaria/files/en-US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@
439439
},
440440
"downloads": {
441441
"title": "Weekly Downloads",
442-
"community_distribution": "View community adoption distribution"
442+
"community_distribution": "View community adoption distribution",
443+
"subtitle": "Across all versions"
443444
},
444445
"install_scripts": {
445446
"title": "Install Scripts",

lunaria/files/fr-FR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@
414414
},
415415
"downloads": {
416416
"title": "Téléchargements hebdo.",
417-
"community_distribution": "Voir la distribution des versions téléchargées par la communauté"
417+
"community_distribution": "Voir la distribution des versions téléchargées par la communauté",
418+
"subtitle": "Toutes versions confondues"
418419
},
419420
"install_scripts": {
420421
"title": "Scripts d'installation",

test/nuxt/components/PackageWeeklyDownloadStats.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ describe('PackageWeeklyDownloadStats', () => {
4040
})
4141

4242
expect(component.text()).toContain('Weekly Downloads')
43+
expect(component.text()).toContain('Across all versions')
4344
expect(component.text()).toContain('No data available')
4445
})
4546

@@ -60,6 +61,7 @@ describe('PackageWeeklyDownloadStats', () => {
6061
})
6162

6263
expect(component.text()).toContain('Weekly Downloads')
64+
expect(component.text()).toContain('Across all versions')
6365
expect(component.text()).not.toContain('No data available')
6466
})
6567
})

0 commit comments

Comments
 (0)