design: improve communities page
This commit is contained in:
1 parent
e8f5d743d8
commit
f54c444fe6
6 files changed
+224
-82
No files matched your search
@@ -24,32 +24,62 @@
|
||||
import Entity from '$lib/components/ui/Entity.svelte'
|
||||
|
||||
export let community: CommunityView
|
||||
export let view: 'cozy' | 'compact' = 'compact'
|
||||
export let showCounts: boolean = true
|
||||
|
||||
let showInfo = false
|
||||
</script>
|
||||
|
||||
{#if showInfo}
|
||||
<Modal title={$t('routes.community.title')} bind:open={showInfo}>
|
||||
<Modal title={$t('form.post.community')} bind:open={showInfo}>
|
||||
<CommunityCard community_view={community} />
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
<div class="py-4 flex flex-col gap-2 text-sm max-w-full relative">
|
||||
<div class="flex flex-row items-center max-w-full w-full">
|
||||
<div
|
||||
class={$$props.class ??
|
||||
'py-4 flex flex-col gap-4 text-sm max-w-full relative'}
|
||||
>
|
||||
<div
|
||||
class="flex
|
||||
{view == 'cozy'
|
||||
? 'flex-col gap-2'
|
||||
: 'flex-row'} items-center max-w-full w-full"
|
||||
>
|
||||
<a
|
||||
href="/c/{fullCommunityName(
|
||||
community.community.name,
|
||||
community.community.actor_id
|
||||
)}"
|
||||
class="hover:underline"
|
||||
class="flex-1"
|
||||
>
|
||||
<Entity
|
||||
icon={community.community.icon}
|
||||
label={new URL(community.community.actor_id).hostname}
|
||||
name={community.community.title}
|
||||
></Entity>
|
||||
<div
|
||||
class="flex {view == 'cozy'
|
||||
? 'flex-col gap-2'
|
||||
: 'flex-row'} gap-2 items-center"
|
||||
>
|
||||
<slot name="icon">
|
||||
<Avatar
|
||||
url={community.community.icon}
|
||||
width={32}
|
||||
alt={community.community.name}
|
||||
/>
|
||||
</slot>
|
||||
<div class="flex flex-col">
|
||||
<div class="font-medium text-base">
|
||||
{community.community.title}
|
||||
</div>
|
||||
<div class="text-sm text-slate-600 dark:text-zinc-400">
|
||||
<span>{new URL(community.community.actor_id).hostname}</span>
|
||||
{#if !showCounts}
|
||||
•
|
||||
<FormattedNumber number={community.counts.subscribers} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
<div class="ml-auto flex flex-row items-center gap-2">
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<Button size="square-md" on:click={() => (showInfo = !showInfo)}>
|
||||
<Icon src={InformationCircle} size="16" micro />
|
||||
</Button>
|
||||
@@ -93,8 +123,8 @@
|
||||
</Subscribe>
|
||||
</div>
|
||||
</div>
|
||||
{#if community.counts}
|
||||
<div class="flex flex-row gap-3 items-center">
|
||||
{#if showCounts}
|
||||
<div class="flex flex-row gap-3 items-center justify-center">
|
||||
{#if community.counts.posts}
|
||||
<LabelStat
|
||||
content={community.counts.posts.toString()}
|
||||
|
||||
@@ -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>
|
||||
Reference in new issue
Block a user