feat: Add community stats
This commit is contained in:
1 parent
06c39a17ac
commit
88a93fa6d9
3 files changed
+31
-23
No files matched your search
@@ -24,8 +24,8 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-row gap-4">
|
<div class="flex flex-row gap-4">
|
||||||
<div class="flex flex-col gap-4">
|
<div class="flex flex-col gap-4 max-w-full">
|
||||||
<div class="flex flex-col sm:flex-row gap-4">
|
<div class="flex flex-col sm:flex-row gap-4 max-w-full">
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
options={['Subscribed', 'Local', 'All']}
|
options={['Subscribed', 'Local', 'All']}
|
||||||
selected={$page.url.searchParams.get('type') ?? 'Local'}
|
selected={$page.url.searchParams.get('type') ?? 'Local'}
|
||||||
|
|||||||
@@ -1,21 +1 @@
|
|||||||
<script lang="ts">
|
<slot />
|
||||||
import type { GetCommunityResponse } from 'lemmy-js-client'
|
|
||||||
import Avatar from '../../post/[id]/Avatar.svelte'
|
|
||||||
|
|
||||||
export let data: GetCommunityResponse
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-4">
|
|
||||||
<div class="flex flex-row gap-4 items-center">
|
|
||||||
<Avatar
|
|
||||||
url={data.community_view.community.icon ??
|
|
||||||
`https://api.dicebear.com/6.x/initials/svg?seed=${data.community_view.community.name}`}
|
|
||||||
alt={data.community_view.community.title}
|
|
||||||
width={64}
|
|
||||||
/>
|
|
||||||
<h1 class="font-bold text-xl">
|
|
||||||
{data.community_view.community.name}
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
@@ -6,6 +6,16 @@
|
|||||||
import Avatar from '../../../post/[id]/Avatar.svelte'
|
import Avatar from '../../../post/[id]/Avatar.svelte'
|
||||||
import Post from '../../../post/[id]/Post.svelte'
|
import Post from '../../../post/[id]/Post.svelte'
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
|
import RelativeDate from '$lib/components/RelativeDate.svelte'
|
||||||
|
import {
|
||||||
|
Calendar,
|
||||||
|
ChatBubbleOvalLeftEllipsis,
|
||||||
|
Icon,
|
||||||
|
Newspaper,
|
||||||
|
PencilSquare,
|
||||||
|
UserGroup,
|
||||||
|
} from 'svelte-hero-icons'
|
||||||
|
import FormattedNumber from '$lib/components/FormattedNumber.svelte'
|
||||||
|
|
||||||
export let data
|
export let data
|
||||||
</script>
|
</script>
|
||||||
@@ -56,6 +66,24 @@
|
|||||||
`https://api.dicebear.com/6.x/initials/svg?seed=${data.community_view.community.name}`}
|
`https://api.dicebear.com/6.x/initials/svg?seed=${data.community_view.community.name}`}
|
||||||
alt={data.community_view.community.name}
|
alt={data.community_view.community.name}
|
||||||
/>
|
/>
|
||||||
|
<span class="flex flex-row items-center gap-1 text-sm">
|
||||||
|
<Icon src={Calendar} width={16} height={16} mini />
|
||||||
|
<RelativeDate date={new Date(data.community_view.community.published)} />
|
||||||
|
</span>
|
||||||
|
<div class="text-sm flex flex-row flex-wrap gap-3">
|
||||||
|
<span class="flex flex-row items-center gap-1">
|
||||||
|
<Icon src={UserGroup} width={16} height={16} mini />
|
||||||
|
<FormattedNumber number={data.community_view.counts.subscribers} />
|
||||||
|
</span>
|
||||||
|
<span class="flex flex-row items-center gap-1">
|
||||||
|
<Icon src={PencilSquare} width={16} height={16} mini />
|
||||||
|
<FormattedNumber number={data.community_view.counts.posts} />
|
||||||
|
</span>
|
||||||
|
<span class="flex flex-row items-center gap-1">
|
||||||
|
<Icon src={ChatBubbleOvalLeftEllipsis} width={16} height={16} mini />
|
||||||
|
<FormattedNumber number={data.community_view.counts.comments} />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<h1 class="font-bold text-lg">{data.community_view.community.name}</h1>
|
<h1 class="font-bold text-lg">{data.community_view.community.name}</h1>
|
||||||
<SvelteMarkdown source={data.community_view.community.description} />
|
<SvelteMarkdown source={data.community_view.community.description} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user