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

@@ -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()}