design: improve communities page

This commit is contained in:
Xylight committed 2024-08-17 18:35:10 -07:00
1 parent e8f5d743d8
commit f54c444fe6
6 files changed
+224 -82

No files matched your search

+49 -17
View File
@@ -7,29 +7,61 @@
} from 'svelte-hero-icons'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import LabelStat from '$lib/components/ui/LabelStat.svelte'
import { userLink } from '$lib/lemmy/generic'
import Avatar from '$lib/components/ui/Avatar.svelte'
export let user: PersonView
export let view: 'cozy' | 'compact' = 'compact'
export let showCounts: boolean = true
</script>
<div
class="py-2
flex flex-col gap-3 text-sm max-w-full"
class={$$props.class ??
'py-4 flex flex-col gap-4 text-sm max-w-full relative'}
>
<div class="flex flex-row items-center">
<span
class="break-words max-w-full w-max text-base font-bold text-sky-400 hover:underline"
>
<UserLink avatar user={user.person} />
</span>
<div
class="flex
{view == 'cozy'
? 'flex-col gap-2'
: 'flex-row'} items-center max-w-full w-full"
>
<a href={userLink(user.person)} class="flex-1">
<div
class="flex {view == 'cozy'
? 'flex-col gap-2'
: 'flex-row'} gap-2 items-center"
>
<slot name="icon">
<Avatar url={user.person.avatar} width={32} alt={user.person.name} />
</slot>
<div class="flex flex-col">
<div class="font-medium text-base">
{user.person.display_name ?? user.person.name}
</div>
<div class="text-sm text-slate-600 dark:text-zinc-400">
{new URL(user.person.actor_id).hostname}
</div>
</div>
</div>
</a>
</div>
<div class="flex flex-row gap-3 items-center">
<div class="flex flex-row gap-1 items-center" title="Post count">
<Icon src={PencilSquare} mini width={16} />
<FormattedNumber number={user.counts.post_count} />
{#if showCounts}
<div class="flex flex-row gap-3 items-center justify-center">
{#if user.counts.post_count}
<LabelStat
content={user.counts.post_count.toString()}
formatted
label="Posts"
/>
{/if}
{#if user.counts.comment_count}
<LabelStat
content={user.counts.comment_count.toString()}
formatted
label="Comments"
/>
{/if}
</div>
<div class="flex flex-row gap-1 items-center" title="Comment count">
<Icon src={ChatBubbleOvalLeftEllipsis} mini width={16} />
<FormattedNumber number={user.counts.comment_count} />
</div>
</div>
{/if}
</div>