fix: user list not used in community page
This commit is contained in:
1 parent
33371fe640
commit
42cae8c30b
2 files changed
+14
-26
No files matched your search
@@ -44,6 +44,8 @@
|
|||||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||||
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
import LabelStat from '$lib/components/ui/LabelStat.svelte'
|
||||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||||
|
import ItemList from '../generic/ItemList.svelte'
|
||||||
|
import { communityLink, userLink } from '$lib/lemmy/generic'
|
||||||
|
|
||||||
export let community_view: CommunityView
|
export let community_view: CommunityView
|
||||||
export let moderators: CommunityModeratorView[] = []
|
export let moderators: CommunityModeratorView[] = []
|
||||||
@@ -250,29 +252,15 @@
|
|||||||
<svelte:fragment slot="title">
|
<svelte:fragment slot="title">
|
||||||
<ShieldIcon width={15} filled /> Moderators
|
<ShieldIcon width={15} filled /> Moderators
|
||||||
</svelte:fragment>
|
</svelte:fragment>
|
||||||
<div
|
<ItemList
|
||||||
class="flex items-center -space-x-1 flex-wrap hover:space-x-1 transition-all
|
items={moderators.map((m) => ({
|
||||||
cursor-pointer"
|
id: m.moderator.id,
|
||||||
>
|
name: m.moderator.name,
|
||||||
{#each moderators as moderator}
|
url: userLink(m.moderator),
|
||||||
<Popover openOnHover placement="top-start" class="transition-all">
|
avatar: m.moderator.avatar,
|
||||||
<a
|
instance: new URL(m.moderator.actor_id).hostname,
|
||||||
class="block ring rounded-full ring-slate-50 dark:ring-zinc-950 transition-all"
|
}))}
|
||||||
href="/u/{moderator.moderator.name}@{new URL(
|
/>
|
||||||
moderator.moderator.actor_id
|
|
||||||
).hostname}"
|
|
||||||
slot="target"
|
|
||||||
>
|
|
||||||
<Avatar
|
|
||||||
width={28}
|
|
||||||
url={moderator.moderator.avatar}
|
|
||||||
alt={moderator.moderator.name}
|
|
||||||
/>
|
|
||||||
</a>
|
|
||||||
<span class="font-bold">{moderator.moderator.name}</span>
|
|
||||||
</Popover>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</Expandable>
|
</Expandable>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { fullCommunityName } from "$lib/util";
|
import { fullCommunityName } from '$lib/util'
|
||||||
import type { Community, Person } from "lemmy-js-client";
|
import type { Community, Person } from 'lemmy-js-client'
|
||||||
|
|
||||||
export const communityLink = (community: Community, prefix: string = '') =>
|
export const communityLink = (community: Community, prefix: string = '') =>
|
||||||
`${prefix}/c/${fullCommunityName(community.name, community.actor_id)}`
|
`${prefix}/c/${fullCommunityName(community.name, community.actor_id)}`
|
||||||
|
|
||||||
export const userLink = (person: Person, prefix: string = '') =>
|
export const userLink = (person: Person, prefix: string = '') =>
|
||||||
`${prefix}/c/${person.name}@${new URL(person.actor_id).hostname}`
|
`${prefix}/u/${person.name}@${new URL(person.actor_id).hostname}`
|
||||||
Reference in new issue
Block a user