mirror of
https://git.shipoclu.com/moon/plspace.git
synced 2026-08-13 02:42:30 +00:00
refactor and fix all references to emojis
This commit is contained in:
@@ -6,15 +6,17 @@
|
||||
* accounts often return an empty list rather than an error, so the count and
|
||||
* the grid are allowed to disagree; the count is authoritative.
|
||||
*/
|
||||
import type { Account } from '$lib/api/types'
|
||||
import type { Account, CustomEmoji } from '$lib/api/types'
|
||||
import { displayNameOf, formatCount, profilePath } from '$lib/util/profile'
|
||||
import Module from '../common/Module.svelte'
|
||||
import Avatar from '../common/Avatar.svelte'
|
||||
import EmojiText from '../common/EmojiText.svelte'
|
||||
|
||||
interface Props {
|
||||
title: string
|
||||
/** The subject, used in "Tom has 527 friends." */
|
||||
ownerName: string
|
||||
ownerEmojis?: CustomEmoji[]
|
||||
friends: Account[]
|
||||
total: number
|
||||
viewAllHref: string
|
||||
@@ -29,6 +31,7 @@
|
||||
let {
|
||||
title,
|
||||
ownerName,
|
||||
ownerEmojis,
|
||||
friends,
|
||||
total,
|
||||
viewAllHref,
|
||||
@@ -39,7 +42,7 @@
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<Module {title} variant="band">
|
||||
<Module {title} titleEmojis={ownerEmojis} variant="band">
|
||||
{#snippet action()}
|
||||
<a href={viewAllHref}>[view all]</a>
|
||||
{/snippet}
|
||||
@@ -47,10 +50,13 @@
|
||||
<!-- Never render a withheld count as "0 friends" — that reports a privacy
|
||||
setting as a fact about the person. -->
|
||||
{#if countHidden}
|
||||
<p class="friend-count">{ownerName} keeps their friend count private.</p>
|
||||
<p class="friend-count">
|
||||
<EmojiText text={ownerName} emojis={ownerEmojis} /> keeps their friend count private.
|
||||
</p>
|
||||
{:else}
|
||||
<p class="friend-count">
|
||||
{ownerName} has <span class="friend-count-value">{formatCount(total)}</span>
|
||||
<EmojiText text={ownerName} emojis={ownerEmojis} /> has
|
||||
<span class="friend-count-value">{formatCount(total)}</span>
|
||||
friend{total === 1 ? '' : 's'}.
|
||||
</p>
|
||||
{/if}
|
||||
@@ -66,7 +72,11 @@
|
||||
{#each friends as friend (friend.id)}
|
||||
<li class="friend-card" data-account={friend.acct}>
|
||||
<a class="friend-card-link" href={profilePath(friend)}>
|
||||
<span class="friend-card-name">{displayNameOf(friend)}</span>
|
||||
<EmojiText
|
||||
class="friend-card-name"
|
||||
text={displayNameOf(friend)}
|
||||
emojis={friend.emojis}
|
||||
/>
|
||||
<Avatar account={friend} plain size="friend" class="friend-card-photo" />
|
||||
</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user