flotilla/src/app/components/ProfileCircles.svelte

31 lines
823 B
Svelte
Raw Normal View History

2024-10-04 00:04:00 +00:00
<script lang="ts">
2026-01-08 20:08:13 +00:00
import {getProfile, loadProfile} from "@welshman/app"
2024-10-04 00:04:00 +00:00
import ProfileCircle from "@app/components/ProfileCircle.svelte"
type Props = {
pubkeys: string[]
size?: number
}
const {pubkeys, size = 7}: Props = $props()
2025-12-18 02:43:13 +00:00
for (const pubkey of pubkeys) {
loadProfile(pubkey)
}
const visiblePubkeys = $derived.by(() => {
const filtered = pubkeys.filter(pubkey => getProfile(pubkey)?.picture)
return filtered.length > 0 ? filtered : pubkeys.slice(0, 1)
})
2024-10-04 00:04:00 +00:00
</script>
<div class="flex pr-3">
2025-12-18 02:43:13 +00:00
{#each visiblePubkeys.toSorted().slice(0, 15) as pubkey (pubkey)}
2026-01-08 20:08:13 +00:00
<div
class="z-feature -mr-3 inline-block flex h-8 w-8 items-center justify-center rounded-full bg-base-100">
<ProfileCircle class="h-8 w-8 bg-base-300" {pubkey} {size} />
2024-10-04 00:04:00 +00:00
</div>
{/each}
</div>