Skip to content

Commit d0ee467

Browse files
committed
feat: show account count and no-avatar users on PDS page
1 parent ab84ed3 commit d0ee467

1 file changed

Lines changed: 56 additions & 31 deletions

File tree

app/pages/pds.vue

Lines changed: 56 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ const { data: pdsUsers, status: pdsStatus } = useLazyFetch<AtprotoProfile[]>(
3535
const usersWithAvatars = computed(() => {
3636
return pdsUsers.value.filter(user => user.avatar && !brokenImages.value.has(user.handle))
3737
})
38+
39+
const usersWithoutAvatars = computed(() => {
40+
return pdsUsers.value.filter(user => !user.avatar || brokenImages.value.has(user.handle))
41+
})
42+
43+
const totalAccounts = computed(() => pdsUsers.value.length)
3844
</script>
3945

4046
<template>
@@ -121,50 +127,69 @@ const usersWithAvatars = computed(() => {
121127
<h2 id="community-heading" class="text-lg text-fg uppercase tracking-wider mb-4">
122128
{{ $t('pds.community.title') }}
123129
</h2>
124-
<p class="text-fg-muted leading-relaxed mb-6">
130+
<p class="text-fg-muted leading-relaxed mb-2">
125131
{{ $t('pds.community.description') }}
126132
</p>
133+
<p
134+
v-if="pdsStatus === 'success' && totalAccounts > 0"
135+
class="text-fg font-medium mb-6"
136+
>
137+
{{ $t('pds.community.account_count', { count: totalAccounts }) }}
138+
</p>
139+
<div v-else class="mb-6" />
127140

128141
<div v-if="pdsStatus === 'pending'" class="text-fg-subtle text-sm" role="status">
129142
{{ $t('pds.community.loading') }}
130143
</div>
131144
<div v-else-if="pdsStatus === 'error'" class="text-fg-subtle text-sm" role="alert">
132145
{{ $t('pds.community.error') }}
133146
</div>
134-
<div v-else-if="!usersWithAvatars.length" class="text-fg-subtle text-sm">
147+
<div v-else-if="!pdsUsers.length" class="text-fg-subtle text-sm">
135148
{{ $t('pds.community.empty') }}
136149
</div>
137-
<ul
138-
v-else
139-
class="grid grid-cols-[repeat(auto-fill,48px)] justify-center gap-2 list-none p-0"
140-
>
141-
<li v-for="user in usersWithAvatars" :key="user.handle" class="block group relative">
142-
<a
143-
:href="`https://bsky.app/profile/${user.handle}`"
144-
target="_blank"
145-
rel="noopener noreferrer"
146-
:aria-label="$t('pds.community.view_profile', { handle: user.handle })"
147-
class="block rounded-lg"
150+
<div v-else>
151+
<ul
152+
class="grid grid-cols-[repeat(auto-fill,48px)] justify-center gap-2 list-none p-0"
153+
>
154+
<li
155+
v-for="user in usersWithAvatars"
156+
:key="user.handle"
157+
class="block group relative"
148158
>
149-
<img
150-
:src="user.avatar"
151-
:alt="`${user.handle}'s avatar`"
152-
@error="handleImageError(user.handle)"
153-
width="48"
154-
height="48"
155-
class="w-12 h-12 rounded-lg ring-2 ring-transparent group-hover:ring-accent transition-all duration-200 ease-out group-hover:scale-125 will-change-transform"
156-
loading="lazy"
157-
/>
158-
<span
159-
class="pointer-events-none absolute -top-9 inset-is-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900 text-xs px-2 py-1 shadow-lg opacity-0 scale-95 transition-all duration-150 group-hover:opacity-100 group-hover:scale-100"
160-
dir="ltr"
161-
role="tooltip"
159+
<a
160+
:href="`https://bsky.app/profile/${user.handle}`"
161+
target="_blank"
162+
rel="noopener noreferrer"
163+
:aria-label="$t('pds.community.view_profile', { handle: user.handle })"
164+
class="block rounded-lg"
162165
>
163-
@{{ user.handle }}
164-
</span>
165-
</a>
166-
</li>
167-
</ul>
166+
<img
167+
:src="user.avatar"
168+
:alt="`${user.handle}'s avatar`"
169+
@error="handleImageError(user.handle)"
170+
width="48"
171+
height="48"
172+
class="w-12 h-12 rounded-lg ring-2 ring-transparent group-hover:ring-accent transition-all duration-200 ease-out group-hover:scale-125 will-change-transform"
173+
loading="lazy"
174+
/>
175+
<span
176+
class="pointer-events-none absolute -top-9 inset-is-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900 text-xs px-2 py-1 shadow-lg opacity-0 scale-95 transition-all duration-150 group-hover:opacity-100 group-hover:scale-100"
177+
dir="ltr"
178+
role="tooltip"
179+
>
180+
@{{ user.handle }}
181+
</span>
182+
</a>
183+
</li>
184+
</ul>
185+
<div
186+
v-if="usersWithoutAvatars.length"
187+
class="flex items-center justify-center gap-2 mt-4 text-fg-muted text-sm"
188+
>
189+
<AppMark class="w-5 h-auto" />
190+
<span>{{ $t('pds.community.new_accounts', { count: usersWithoutAvatars.length }) }}</span>
191+
</div>
192+
</div>
168193
</div>
169194
</section>
170195
</article>

0 commit comments

Comments
 (0)