Skip to content

Commit ecda66d

Browse files
authored
Merge branch 'main' into sparkline-monospace-weekly-downloads
2 parents ac1bd6a + d802ac1 commit ecda66d

7 files changed

Lines changed: 82 additions & 18 deletions

File tree

app/components/CallToAction.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ const socialLinks = computed(() => [
2525
ctaKey: $t('about.get_involved.follow.cta'),
2626
},
2727
])
28+
29+
function handleCardClick(event: MouseEvent) {
30+
if ((event.target as HTMLElement).closest(':any-link')) return
31+
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return
32+
33+
const selection = window.getSelection()
34+
if (selection && selection.type === 'Range') return
35+
36+
const card = event.currentTarget as HTMLElement
37+
const link = card.querySelector('a')
38+
link?.click()
39+
}
2840
</script>
2941

3042
<template>
@@ -37,15 +49,16 @@ const socialLinks = computed(() => [
3749
<div
3850
v-for="link in socialLinks"
3951
:key="link.id"
40-
class="group relative grid gap-3 p-4 rounded-lg bg-bg-subtle hover:bg-bg-elevated border border-border hover:border-border-hover transition-all duration-200 sm:grid-rows-subgrid sm:row-span-3 focus-within:ring-2 focus-within:ring-accent/50"
52+
@click="handleCardClick"
53+
class="cursor-pointer group relative grid gap-3 p-4 rounded-lg bg-bg-subtle hover:bg-bg-elevated border border-border hover:border-border-hover transition-all duration-200 sm:grid-rows-subgrid sm:row-span-3 focus-within:ring-2 focus-within:ring-accent/50"
4154
>
42-
<h3 class="z-1 flex gap-2">
55+
<h3 class="flex gap-2">
4356
<span :class="link.icon" class="shrink-0 mt-1 w-5 h-5 text-fg" aria-hidden="true" />
4457
<span class="font-medium text-fg">
4558
{{ link.titleKey }}
4659
</span>
4760
</h3>
48-
<p class="z-1 text-sm text-fg-muted leading-relaxed">
61+
<p class="text-sm text-fg-muted leading-relaxed">
4962
{{ link.descriptionKey }}
5063
</p>
5164
<a
@@ -56,7 +69,6 @@ const socialLinks = computed(() => [
5669
>
5770
{{ link.ctaKey }}
5871
<span class="i-lucide:arrow-right rtl-flip w-3 h-3" aria-hidden="true" />
59-
<span class="absolute z-0 inset-0" aria-hidden="true" />
6072
</a>
6173
</div>
6274
</div>

app/composables/useNumberFormatter.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,21 @@ export const useBytesFormatter = () => {
1616
const decimalNumberFormatter = useNumberFormatter({
1717
maximumFractionDigits: 1,
1818
})
19+
const KB = 1000
20+
const MB = 1000 * 1000
1921

2022
return {
2123
format: (bytes: number) => {
22-
if (bytes < 1024)
24+
if (bytes < KB)
2325
return t('package.size.b', {
2426
size: decimalNumberFormatter.value.format(bytes),
2527
})
26-
if (bytes < 1024 * 1024)
28+
if (bytes < MB)
2729
return t('package.size.kb', {
28-
size: decimalNumberFormatter.value.format(bytes / 1024),
30+
size: decimalNumberFormatter.value.format(bytes / KB),
2931
})
3032
return t('package.size.mb', {
31-
size: decimalNumberFormatter.value.format(bytes / (1024 * 1024)),
33+
size: decimalNumberFormatter.value.format(bytes / MB),
3234
})
3335
},
3436
}

i18n/locales/de-DE.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,11 @@
362362
"y_axis_label": "{granularity} {facet}",
363363
"facet": "Facette",
364364
"title": "Trends",
365+
"contributors_skip": "Nicht angezeigt bei Mitwirkende (hat kein GitHub-Repository): | Nicht angezeigt bei Mitwirkende (haben kein GitHub-Repository):",
365366
"items": {
366367
"downloads": "Downloads",
367-
"likes": "Likes"
368+
"likes": "Likes",
369+
"contributors": "Mitwirkende"
368370
}
369371
},
370372
"downloads": {
@@ -1123,7 +1125,7 @@
11231125
},
11241126
"contact": {
11251127
"title": "Feedback",
1126-
"p1": "Wenn du bei {app} auf eine Barriere stoßt, sag uns bitte Bescheid, indem du ein Ticket in unserem {link} eröffnest. Wir nehmen diese Meldungen ernst und werden unser Bestes tun, um sie zu beheben.",
1128+
"p1": "Wenn du bei {app} auf eine Barriere stößt, sag uns bitte Bescheid, indem du ein Ticket in unserem {link} eröffnest. Wir nehmen diese Meldungen ernst und werden unser Bestes tun, um sie zu beheben.",
11271129
"link": "GitHub-Repository"
11281130
}
11291131
}

lunaria/files/de-DE.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,11 @@
361361
"y_axis_label": "{granularity} {facet}",
362362
"facet": "Facette",
363363
"title": "Trends",
364+
"contributors_skip": "Nicht angezeigt bei Mitwirkende (hat kein GitHub-Repository): | Nicht angezeigt bei Mitwirkende (haben kein GitHub-Repository):",
364365
"items": {
365366
"downloads": "Downloads",
366-
"likes": "Likes"
367+
"likes": "Likes",
368+
"contributors": "Mitwirkende"
367369
}
368370
},
369371
"downloads": {
@@ -1122,7 +1124,7 @@
11221124
},
11231125
"contact": {
11241126
"title": "Feedback",
1125-
"p1": "Wenn du bei {app} auf eine Barriere stoßt, sag uns bitte Bescheid, indem du ein Ticket in unserem {link} eröffnest. Wir nehmen diese Meldungen ernst und werden unser Bestes tun, um sie zu beheben.",
1127+
"p1": "Wenn du bei {app} auf eine Barriere stößt, sag uns bitte Bescheid, indem du ein Ticket in unserem {link} eröffnest. Wir nehmen diese Meldungen ernst und werden unser Bestes tun, um sie zu beheben.",
11261128
"link": "GitHub-Repository"
11271129
}
11281130
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@iconify-json/svg-spinners": "1.2.4",
6060
"@iconify-json/vscode-icons": "1.2.40",
6161
"@intlify/shared": "11.2.8",
62-
"@lunariajs/core": "https://pkg.pr.new/lunariajs/lunaria/@lunariajs/core@f07e1a3",
62+
"@lunariajs/core": "https://pkg.pr.new/lunariajs/lunaria/@lunariajs/core@904b935",
6363
"@napi-rs/canvas": "0.1.92",
6464
"@nuxt/a11y": "1.0.0-alpha.1",
6565
"@nuxt/fonts": "0.13.0",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
2+
import { computed, ref } from 'vue'
3+
import { useBytesFormatter } from '../../../../app/composables/useNumberFormatter'
4+
5+
describe('useBytesFormatter', () => {
6+
beforeEach(() => {
7+
vi.stubGlobal('computed', computed)
8+
vi.stubGlobal('useI18n', () => ({
9+
locale: ref('en-US'),
10+
t: (key: string, params?: { size?: string }) => {
11+
const size = params?.size ?? ''
12+
13+
if (key === 'package.size.b') return `${size} B`
14+
if (key === 'package.size.kb') return `${size} kB`
15+
if (key === 'package.size.mb') return `${size} MB`
16+
17+
return key
18+
},
19+
}))
20+
})
21+
22+
afterEach(() => {
23+
vi.unstubAllGlobals()
24+
})
25+
26+
it('formats values below 1 kB in bytes', () => {
27+
const { format } = useBytesFormatter()
28+
29+
expect(format(0)).toBe('0 B')
30+
expect(format(999)).toBe('999 B')
31+
})
32+
33+
it('formats kB values using decimal base (1000)', () => {
34+
const { format } = useBytesFormatter()
35+
36+
expect(format(1000)).toBe('1 kB')
37+
expect(format(8414)).toBe('8.4 kB')
38+
})
39+
40+
it('formats MB values using decimal base (1000 * 1000)', () => {
41+
const { format } = useBytesFormatter()
42+
43+
expect(format(1_000_000)).toBe('1 MB')
44+
expect(format(1_500_000)).toBe('1.5 MB')
45+
})
46+
})

0 commit comments

Comments
 (0)