Skip to content

Commit 76278b0

Browse files
committed
fix: remove v-once and custom aria label
1 parent 972b453 commit 76278b0

File tree

4 files changed

+17
-52
lines changed

4 files changed

+17
-52
lines changed

app/pages/about.vue

Lines changed: 15 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,18 @@ function isExpandable(c: GitHubContributor) {
5252
)
5353
}
5454
55-
const contributors = computed(() => data.value ?? [])
55+
function* mapContributors(
56+
c: GitHubContributor[],
57+
): Generator<GitHubContributor & { expandable: boolean }> {
58+
for (const x of c) {
59+
yield {
60+
...x,
61+
expandable: isExpandable(x),
62+
}
63+
}
64+
}
65+
66+
const contributors = computed(() => [...mapContributors(data.value ?? [])])
5667
5768
const roleLabels = computed(
5869
() =>
@@ -62,25 +73,6 @@ const roleLabels = computed(
6273
}) as Partial<Record<Role, string>>,
6374
)
6475
65-
function getAriaLabel(c: GitHubContributor): string {
66-
const separator = $t('about.contributors.separator')
67-
const role = roleLabels.value[c.role]
68-
? $t('about.contributors.role', { separator, role: roleLabels.value[c.role] })
69-
: ''
70-
const works_at = c.company
71-
? $t('about.contributors.works_at', { separator, company: c.company })
72-
: ''
73-
const location = c.location
74-
? $t('about.contributors.location', { separator, location: c.location })
75-
: ''
76-
return $t('about.contributors.view_profile_detailed', {
77-
name: c.name || c.login,
78-
role,
79-
works_at,
80-
location,
81-
})
82-
}
83-
8476
// --- Popover Logic (Global Single Instance with Event Delegation) ---
8577
// We use a single global popover instance for performance (especially in Firefox with many items).
8678
// Event delegation on the list handles interactions, avoiding listeners on every item.
@@ -470,16 +462,15 @@ onBeforeUnmount(() => {
470462
<li
471463
v-for="contributor in contributors"
472464
:key="contributor.id"
473-
v-once
474465
class="relative h-12 w-12 list-none group"
475466
style="contain: layout style"
476467
>
477468
<LinkBase
478-
v-if="!isExpandable(contributor)"
469+
v-if="!contributor.expandable"
479470
:to="contributor.html_url"
471+
:aria-label="contributor.login"
480472
no-underline
481473
no-new-tab-icon
482-
:aria-label="getAriaLabel(contributor)"
483474
class="group relative block h-12 w-12 rounded-lg transition-transform outline-none p-0 bg-transparent"
484475
>
485476
<img
@@ -501,7 +492,7 @@ onBeforeUnmount(() => {
501492
v-else
502493
type="button"
503494
:data-cid="contributor.id"
504-
:aria-label="getAriaLabel(contributor)"
495+
:aria-label="contributor.login"
505496
class="group relative block h-12 w-12 rounded-lg transition-transform duration-200 outline-none p-0 border-none cursor-pointer bg-transparent"
506497
>
507498
<img
@@ -520,7 +511,6 @@ onBeforeUnmount(() => {
520511
</section>
521512
</article>
522513

523-
<!-- UN ÚNICO nodo de popover, FUERA del v-for -->
524514
<Transition name="pop">
525515
<div
526516
v-if="activeContributor"

i18n/locales/en.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -946,12 +946,7 @@
946946
"description": "npmx is fully open source, built by an amazing community of contributors. Join us and let's build the npm browsing experience we always wanted, together.",
947947
"loading": "Loading contributors...",
948948
"error": "Failed to load contributors",
949-
"avatar": "{name}'s avatar",
950-
"view_profile_detailed": "View {name}'s GitHub profile{role}{works_at}{location}",
951-
"separator": "",
952-
"role": "{separator}{role} at npmx.dev",
953-
"works_at": "{separator}works at {company}",
954-
"location": "{separator}based in {location}"
949+
"avatar": "{name}'s avatar"
955950
},
956951
"get_involved": {
957952
"title": "Get involved",

i18n/locales/es.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -902,12 +902,7 @@
902902
"description": "npmx es completamente de código abierto, construido por una increíble comunidad de colaboradores. Únete a nosotros y construyamos juntos la experiencia de navegación de npm que siempre quisimos.",
903903
"loading": "Cargando colaboradores...",
904904
"error": "Error al cargar colaboradores",
905-
"avatar": "avatar de {name}",
906-
"view_profile_detailed": "Ver el perfil de GitHub de {name}{role}{works_at}{location}",
907-
"separator": "",
908-
"role": "{separator}{role} en npmx.dev",
909-
"works_at": "{separator}trabaja en {company}",
910-
"location": "{separator}ubicado en {location}"
905+
"avatar": "avatar de {name}"
911906
},
912907
"get_involved": {
913908
"title": "Involúcrate",

i18n/schema.json

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2844,21 +2844,6 @@
28442844
},
28452845
"avatar": {
28462846
"type": "string"
2847-
},
2848-
"view_profile_detailed": {
2849-
"type": "string"
2850-
},
2851-
"separator": {
2852-
"type": "string"
2853-
},
2854-
"role": {
2855-
"type": "string"
2856-
},
2857-
"works_at": {
2858-
"type": "string"
2859-
},
2860-
"location": {
2861-
"type": "string"
28622847
}
28632848
},
28642849
"additionalProperties": false

0 commit comments

Comments
 (0)