Skip to content

Commit 829c412

Browse files
committed
Merge branch 'main' of https://github.com/alex-key/npmx.dev into feat/improve-lunaria-status-page
2 parents bfa664a + 5e2e09e commit 829c412

File tree

25 files changed

+668
-93
lines changed

25 files changed

+668
-93
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"editor.formatOnSave": true,
44
"i18n-ally.keystyle": "nested",
55
"i18n-ally.localesPaths": ["./i18n/locales"],
6-
"typescript.tsdk": "node_modules/typescript/lib",
6+
"js/ts.tsdk.path": "node_modules/typescript/lib",
77
"explorer.fileNesting.enabled": true,
88
"explorer.fileNesting.patterns": {
99
"*.vue": "${capture}.stories.ts"

app/components/Package/Dependencies.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ const numberFormatter = useNumberFormatter()
150150
:to="packageRoute(dep, getVulnerableDepInfo(dep)!.version)"
151151
class="shrink-0"
152152
:class="SEVERITY_TEXT_COLORS[getHighestSeverity(getVulnerableDepInfo(dep)!.counts)]"
153-
:title="`${getVulnerableDepInfo(dep)!.counts.total} vulnerabilities`"
153+
:title="
154+
$t('package.dependencies.vulnerabilities_count', {
155+
count: getVulnerableDepInfo(dep)!.counts.total,
156+
})
157+
"
154158
classicon="i-lucide:shield-check"
155159
>
156160
<span class="sr-only">{{ $t('package.dependencies.view_vulnerabilities') }}</span>
@@ -176,7 +180,11 @@ const numberFormatter = useNumberFormatter()
176180
({{ getOutdatedTooltip(outdatedDeps[dep], $t) }})
177181
</span>
178182
<span v-if="getVulnerableDepInfo(dep)" class="sr-only">
179-
({{ getVulnerableDepInfo(dep)!.counts.total }} vulnerabilities)
183+
({{
184+
$t('package.dependencies.vulnerabilities_count', {
185+
count: getVulnerableDepInfo(dep)!.counts.total,
186+
})
187+
}})
180188
</span>
181189
</span>
182190
</li>

app/components/Package/ListToolbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ const { selectedPackages, clearSelectedPackages } = usePackageSelection()
228228
</ButtonBase>
229229
<button
230230
@click="clearSelectedPackages"
231-
aria-label="Close action bar"
231+
:aria-label="$t('filters.clear_selected_label')"
232232
class="flex items-center ms-2"
233233
>
234234
<span class="i-lucide:x text-sm" />

app/components/Package/SkillsModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function getWarningTooltip(skill: SkillListItem): string | undefined {
8383
"
8484
@click="selectedMethod = 'skills-cli'"
8585
>
86-
skills CLI
86+
{{ $t('package.skills.skills_cli') }}
8787
</button>
8888
</div>
8989
</div>

app/components/Package/TableRow.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ const isSelected = computed<boolean>(() => {
2222
return isPackageSelected(props.result.package.name)
2323
})
2424
25-
function formatDownloads(count?: number): string {
26-
if (count === undefined) return '-'
27-
if (count >= 1_000_000) return `${(count / 1_000_000).toFixed(1)}M`
28-
if (count >= 1_000) return `${(count / 1_000).toFixed(1)}K`
29-
return count.toString()
30-
}
31-
3225
function formatScore(value?: number): string {
3326
if (value === undefined || value === 0) return '-'
3427
return Math.round(value * 100).toString()
@@ -44,6 +37,8 @@ const allMaintainersText = computed(() => {
4437
if (!pkg.value.maintainers?.length) return ''
4538
return pkg.value.maintainers.map(m => m.name || m.email).join(', ')
4639
})
40+
41+
const compactNumberFormatter = useCompactNumberFormatter()
4742
</script>
4843

4944
<template>
@@ -89,7 +84,11 @@ const allMaintainersText = computed(() => {
8984
v-if="isColumnVisible('downloads')"
9085
class="py-2 px-3 font-mono text-xs text-fg-muted text-end tabular-nums"
9186
>
92-
{{ formatDownloads(result.downloads?.weekly) }}
87+
{{
88+
result.downloads?.weekly !== undefined
89+
? compactNumberFormatter.format(result.downloads.weekly)
90+
: '-'
91+
}}
9392
</td>
9493

9594
<!-- Updated -->

app/components/Package/VersionDistribution.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ const chartConfig = computed<VueUiXyConfig>(() => {
375375
tabindex="0"
376376
class="i-lucide:info w-3.5 h-3.5 text-fg-subtle cursor-help shrink-0 rounded-sm"
377377
role="img"
378-
aria-label="versions info"
378+
:aria-label="$t('package.versions.grouping_versions_about')"
379379
/>
380380
</TooltipApp>
381381
</label>
@@ -412,7 +412,7 @@ const chartConfig = computed<VueUiXyConfig>(() => {
412412
tabindex="0"
413413
class="i-lucide:info w-3.5 h-3.5 text-fg-subtle cursor-help shrink-0 rounded-sm"
414414
role="img"
415-
aria-label="versions info"
415+
:aria-label="$t('package.versions.grouping_usage_about')"
416416
/>
417417
</TooltipApp>
418418
</label>

app/components/PaginationControls.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function handlePageSizeChange(event: Event) {
155155
@change="handlePageSizeChange"
156156
:items="
157157
PAGE_SIZE_OPTIONS.map(size => ({
158-
label: $t('filters.pagination.per_page', { count: size }),
158+
label: $t('filters.pagination.per_page', { count: $n(size) }),
159159
value: String(size),
160160
}))
161161
"
@@ -207,7 +207,7 @@ function handlePageSizeChange(event: Event) {
207207
:aria-current="page === currentPage ? 'page' : undefined"
208208
@click="goToPage(page)"
209209
>
210-
{{ page }}
210+
{{ $n(page) }}
211211
</button>
212212
</template>
213213

app/components/VersionSelector.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ watch(
543543
type="button"
544544
class="w-4 h-4 flex items-center justify-center text-fg-subtle hover:text-fg transition-colors shrink-0"
545545
:aria-expanded="group.isExpanded"
546-
:aria-label="group.isExpanded ? 'Collapse' : 'Expand'"
546+
:aria-label="group.isExpanded ? $t('common.collapse') : $t('common.expand')"
547547
@click.stop="toggleGroup(group.id)"
548548
>
549549
<span

app/components/diff/ViewerPanel.vue

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function getCodeUrl(version: string): string {
145145
@click="showOptions = !showOptions"
146146
>
147147
<span class="i-lucide:settings w-3.5 h-3.5" />
148-
Options
148+
{{ $t('compare.options') }}
149149
<span
150150
class="i-lucide:chevron-down w-3 h-3 transition-transform"
151151
:class="{ 'rotate-180': showOptions }"
@@ -174,10 +174,13 @@ function getCodeUrl(version: string): string {
174174
>
175175
<div class="flex flex-col gap-2">
176176
<!-- Merge modified lines toggle -->
177-
<SettingsToggle label="Merge modified lines" v-model="mergeModifiedLines" />
177+
<SettingsToggle
178+
:label="$t('compare.merge_modified_lines')"
179+
v-model="mergeModifiedLines"
180+
/>
178181

179182
<!-- Word wrap toggle -->
180-
<SettingsToggle label="Word wrap" v-model="wordWrap" />
183+
<SettingsToggle :label="$t('compare.word_wrap')" v-model="wordWrap" />
181184

182185
<!-- Sliders -->
183186
<div
@@ -186,14 +189,14 @@ function getCodeUrl(version: string): string {
186189
>
187190
<!-- Change ratio slider -->
188191
<div class="sr-only">
189-
<label for="change-ratio">Change ratio</label>
192+
<label for="change-ratio">{{ $t('compare.change_ratio') }}</label>
190193
</div>
191194
<div
192195
class="slider-shell w-full min-w-0"
193196
:class="{ 'is-disabled': !mergeModifiedLines }"
194197
>
195198
<div class="slider-labels">
196-
<span class="slider-label">Change ratio</span>
199+
<span class="slider-label">{{ $t('compare.change_ratio') }}</span>
197200
<span class="slider-value tabular-nums">{{ maxChangeRatio.toFixed(2) }}</span>
198201
</div>
199202
<div class="slider-track">
@@ -219,14 +222,14 @@ function getCodeUrl(version: string): string {
219222

220223
<!-- Diff distance slider -->
221224
<div class="sr-only">
222-
<label for="diff-distance">Diff distance</label>
225+
<label for="diff-distance">{{ $t('compare.diff_distance') }}</label>
223226
</div>
224227
<div
225228
class="slider-shell w-full min-w-0"
226229
:class="{ 'is-disabled': !mergeModifiedLines }"
227230
>
228231
<div class="slider-labels">
229-
<span class="slider-label">Diff distance</span>
232+
<span class="slider-label">{{ $t('compare.diff_distance') }}</span>
230233
<span class="slider-value tabular-nums">{{ maxDiffDistance }}</span>
231234
</div>
232235
<div class="slider-track">
@@ -252,14 +255,14 @@ function getCodeUrl(version: string): string {
252255

253256
<!-- Char edits slider -->
254257
<div class="sr-only">
255-
<label for="char-edits">Char edits</label>
258+
<label for="char-edits">{{ $t('compare.char_edits') }}</label>
256259
</div>
257260
<div
258261
class="slider-shell w-full min-w-0"
259262
:class="{ 'is-disabled': !mergeModifiedLines }"
260263
>
261264
<div class="slider-labels">
262-
<span class="slider-label">Char edits</span>
265+
<span class="slider-label">{{ $t('compare.char_edits') }}</span>
263266
<span class="slider-value tabular-nums">{{ inlineMaxCharEdits }}</span>
264267
</div>
265268
<div class="slider-track">
@@ -295,7 +298,7 @@ function getCodeUrl(version: string): string {
295298
class="px-2 py-1 text-xs text-fg-muted hover:text-fg bg-bg-muted border border-border rounded transition-colors"
296299
target="_blank"
297300
>
298-
View file
301+
{{ $t('compare.view_file') }}
299302
</NuxtLink>
300303
</div>
301304
</div>
@@ -317,22 +320,22 @@ function getCodeUrl(version: string): string {
317320
<!-- Loading state -->
318321
<div v-else-if="status === 'pending'" class="py-12 text-center">
319322
<div class="i-svg-spinners-ring-resize w-6 h-6 mx-auto text-fg-muted" />
320-
<p class="mt-2 text-sm text-fg-muted">Loading diff...</p>
323+
<p class="mt-2 text-sm text-fg-muted">{{ $t('compare.loading_diff') }}</p>
321324
</div>
322325

323326
<!-- Error state -->
324327
<div v-else-if="status === 'error'" class="py-8 text-center">
325328
<span class="i-lucide:triangle-alert w-8 h-8 mx-auto text-fg-subtle mb-2 block" />
326329
<p class="text-fg-muted text-sm mb-2">
327-
{{ loadError?.message || 'Failed to load diff' }}
330+
{{ loadError?.message || $t('compare.loading_diff_error') }}
328331
</p>
329332
<div class="flex items-center justify-center gap-2">
330333
<NuxtLink
331334
v-if="file.type !== 'removed'"
332335
:to="getCodeUrl(toVersion)"
333336
class="text-xs text-fg-muted hover:text-fg underline"
334337
>
335-
View in code browser
338+
{{ $t('compare.view_in_code_browser') }}
336339
</NuxtLink>
337340
</div>
338341
</div>
@@ -342,7 +345,7 @@ function getCodeUrl(version: string): string {
342345
v-else-if="diff && diff.hunks.length === 0"
343346
class="py-8 text-center text-fg-muted text-sm"
344347
>
345-
No content changes detected
348+
{{ $t('compare.no_content_changes') }}
346349
</div>
347350

348351
<!-- Diff content -->

app/pages/about.stories.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import About from './about.vue'
2+
import type { Meta, StoryObj } from '@storybook-vue/nuxt'
3+
import AppHeader from '~/components/AppHeader.vue'
4+
import AppFooter from '~/components/AppFooter.vue'
5+
6+
const meta = {
7+
component: About,
8+
parameters: {
9+
layout: 'fullscreen',
10+
},
11+
decorators: [
12+
() => ({
13+
components: { AppHeader, AppFooter },
14+
template: `
15+
<div class="min-h-screen flex flex-col bg-bg text-fg">
16+
<AppHeader :show-logo="true" />
17+
<div id="main-content" class="flex-1 flex flex-col" tabindex="-1">
18+
<story />
19+
</div>
20+
<AppFooter />
21+
</div>
22+
`,
23+
}),
24+
],
25+
} satisfies Meta<typeof About>
26+
27+
export default meta
28+
type Story = StoryObj<typeof meta>
29+
30+
export const Default: Story = {}

0 commit comments

Comments
 (0)