Skip to content

Commit 6a5d286

Browse files
vinnymacdanielroeautofix-ci[bot]
authored
feat: show more maintainers (#316)
Co-authored-by: Daniel Roe <daniel@roe.dev> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 507bbd6 commit 6a5d286

16 files changed

Lines changed: 91 additions & 19 deletions

File tree

app/components/PackageMaintainers.vue

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,25 @@ const {
1818
const showAddOwner = shallowRef(false)
1919
const newOwnerUsername = shallowRef('')
2020
const isAdding = shallowRef(false)
21+
const showAllMaintainers = shallowRef(false)
22+
23+
const DEFAULT_VISIBLE_MAINTAINERS = 5
2124
2225
// Show admin controls when connected (let npm CLI handle permission errors)
2326
const canManageOwners = computed(() => isConnected.value)
2427
28+
// Computed for visible maintainers with show more/fewer support
29+
const visibleMaintainers = computed(() => {
30+
if (canManageOwners.value || showAllMaintainers.value) {
31+
return maintainerAccess.value
32+
}
33+
return maintainerAccess.value.slice(0, DEFAULT_VISIBLE_MAINTAINERS)
34+
})
35+
36+
const hiddenMaintainersCount = computed(() =>
37+
Math.max(0, maintainerAccess.value.length - DEFAULT_VISIBLE_MAINTAINERS),
38+
)
39+
2540
// Extract org name from scoped package
2641
const orgName = computed(() => {
2742
if (!props.packageName.startsWith('@')) return null
@@ -173,14 +188,17 @@ watch(
173188
</h2>
174189
<ul class="space-y-2 list-none m-0 p-0" :aria-label="$t('package.maintainers.list_label')">
175190
<li
176-
v-for="maintainer in maintainerAccess.slice(0, canManageOwners ? undefined : 5)"
191+
v-for="maintainer in visibleMaintainers"
177192
:key="maintainer.name ?? maintainer.email"
178193
class="flex items-center justify-between gap-2"
179194
>
180195
<div class="flex items-center gap-2 min-w-0">
181196
<NuxtLink
182197
v-if="maintainer.name"
183-
:to="{ name: '~username', params: { username: maintainer.name } }"
198+
:to="{
199+
name: '~username',
200+
params: { username: maintainer.name },
201+
}"
184202
class="link-subtle font-mono text-sm shrink-0"
185203
>
186204
@{{ maintainer.name }}
@@ -192,7 +210,11 @@ watch(
192210
v-if="isConnected && maintainer.accessVia?.length && !isLoadingAccess"
193211
class="text-xs text-fg-subtle truncate"
194212
>
195-
{{ $t('package.maintainers.via', { teams: maintainer.accessVia.join(', ') }) }}
213+
{{
214+
$t('package.maintainers.via', {
215+
teams: maintainer.accessVia.join(', '),
216+
})
217+
}}
196218
</span>
197219
<span
198220
v-if="canManageOwners && maintainer.name === npmUser"
@@ -206,14 +228,34 @@ watch(
206228
v-if="canManageOwners && maintainer.name && maintainer.name !== npmUser"
207229
type="button"
208230
class="p-1 text-fg-subtle hover:text-red-400 transition-colors duration-200 shrink-0 rounded focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
209-
:aria-label="$t('package.maintainers.remove_owner', { name: maintainer.name })"
231+
:aria-label="
232+
$t('package.maintainers.remove_owner', {
233+
name: maintainer.name,
234+
})
235+
"
210236
@click="handleRemoveOwner(maintainer.name)"
211237
>
212238
<span class="i-carbon-close block w-3.5 h-3.5" aria-hidden="true" />
213239
</button>
214240
</li>
215241
</ul>
216242

243+
<!-- Show more/less toggle (only when not managing and there are hidden maintainers) -->
244+
<button
245+
v-if="!canManageOwners && hiddenMaintainersCount > 0"
246+
type="button"
247+
class="mt-2 text-xs text-fg-muted hover:text-fg transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 rounded"
248+
@click="showAllMaintainers = !showAllMaintainers"
249+
>
250+
{{
251+
showAllMaintainers
252+
? $t('package.maintainers.show_less')
253+
: $t('package.maintainers.show_more', {
254+
count: hiddenMaintainersCount,
255+
})
256+
}}
257+
</button>
258+
217259
<!-- Add owner form (only when can manage) -->
218260
<div v-if="canManageOwners" class="mt-3">
219261
<div v-if="showAddOwner">

i18n/locales/de-DE.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@
203203
"username_placeholder": "Benutzername...",
204204
"add_button": "Hinzufügen",
205205
"cancel_add": "Owner-Hinzufügung abbrechen",
206-
"add_owner": "+ Owner hinzufügen"
206+
"add_owner": "+ Owner hinzufügen",
207+
"show_more": "({count} weitere anzeigen)",
208+
"show_less": "(weniger anzeigen)"
207209
},
208210
"downloads": {
209211
"title": "Wöchentliche Downloads",

i18n/locales/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@
206206
"username_placeholder": "username...",
207207
"add_button": "add",
208208
"cancel_add": "Cancel adding owner",
209-
"add_owner": "+ Add owner"
209+
"add_owner": "+ Add owner",
210+
"show_more": "(show {count} more)",
211+
"show_less": "(show fewer)"
210212
},
211213
"downloads": {
212214
"title": "Weekly Downloads",

i18n/locales/es.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@
173173
"username_placeholder": "nombre de usuario...",
174174
"add_button": "agregar",
175175
"cancel_add": "Cancelar agregar propietario",
176-
"add_owner": "+ Agregar propietario"
176+
"add_owner": "+ Agregar propietario",
177+
"show_more": "(mostrar {count} más)",
178+
"show_less": "(mostrar menos)"
177179
},
178180
"downloads": {
179181
"title": "Descargas Semanales",

i18n/locales/fr-FR.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@
163163
"username_placeholder": "nom d'utilisateur...",
164164
"add_button": "ajouter",
165165
"cancel_add": "Annuler l'ajout de propriétaire",
166-
"add_owner": "+ Ajouter un propriétaire"
166+
"add_owner": "+ Ajouter un propriétaire",
167+
"show_more": "(afficher {count} de plus)",
168+
"show_less": "(afficher moins)"
167169
},
168170
"downloads": {
169171
"title": "Téléchargements hebdomadaires",

i18n/locales/it-IT.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@
173173
"username_placeholder": "nome utente...",
174174
"add_button": "aggiungi",
175175
"cancel_add": "Cancella aggiunta proprietario",
176-
"add_owner": "+ Aggiungi proprietario"
176+
"add_owner": "+ Aggiungi proprietario",
177+
"show_more": "(mostra altri {count})",
178+
"show_less": "(mostra meno)"
177179
},
178180
"downloads": {
179181
"title": "Downloads settimanali",

i18n/locales/ja-JP.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,9 @@
186186
"username_placeholder": "ユーザー名...",
187187
"add_button": "追加",
188188
"cancel_add": "オーナーの追加をキャンセル",
189-
"add_owner": "+ オーナーを追加"
189+
"add_owner": "+ オーナーを追加",
190+
"show_more": "(他 {count} 個を表示)",
191+
"show_less": "(折りたたむ)"
190192
},
191193
"downloads": {
192194
"title": "週間ダウンロード数",

i18n/locales/zh-CN.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,9 @@
173173
"username_placeholder": "用户名...",
174174
"add_button": "添加",
175175
"cancel_add": "取消添加拥有者",
176-
"add_owner": "+ 添加拥有者"
176+
"add_owner": "+ 添加拥有者",
177+
"show_more": "(显示另外 {count} 个)",
178+
"show_less": "(收起)"
177179
},
178180
"downloads": {
179181
"title": "每周下载量",

lunaria/files/de-DE.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@
203203
"username_placeholder": "Benutzername...",
204204
"add_button": "Hinzufügen",
205205
"cancel_add": "Owner-Hinzufügung abbrechen",
206-
"add_owner": "+ Owner hinzufügen"
206+
"add_owner": "+ Owner hinzufügen",
207+
"show_more": "({count} weitere anzeigen)",
208+
"show_less": "(weniger anzeigen)"
207209
},
208210
"downloads": {
209211
"title": "Wöchentliche Downloads",

lunaria/files/en-US.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@
206206
"username_placeholder": "username...",
207207
"add_button": "add",
208208
"cancel_add": "Cancel adding owner",
209-
"add_owner": "+ Add owner"
209+
"add_owner": "+ Add owner",
210+
"show_more": "(show {count} more)",
211+
"show_less": "(show fewer)"
210212
},
211213
"downloads": {
212214
"title": "Weekly Downloads",

0 commit comments

Comments
 (0)