82 lines
2.4 KiB
Svelte
82 lines
2.4 KiB
Svelte
<script lang="ts">
|
|
import { page } from '$app/stores'
|
|
import Link from '$lib/components/input/Link.svelte'
|
|
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
|
import Post from '../../../lib/components/lemmy/Post.svelte'
|
|
import { goto } from '$app/navigation'
|
|
import Card from '$lib/components/ui/StickyCard.svelte'
|
|
import CommunityCard from '$lib/components/community/CommunityCard.svelte'
|
|
import Button from '$lib/components/input/Button.svelte'
|
|
import { Color } from '$lib/ui/colors'
|
|
|
|
export let data
|
|
</script>
|
|
|
|
<svelte:head>
|
|
<title>{data.posts.posts[0]?.community.name}</title>
|
|
<meta
|
|
name="og:title"
|
|
content={data.community.community_view.community.name}
|
|
/>
|
|
{#if data.community.community_view.community.description}
|
|
<meta
|
|
name="og:description"
|
|
content={data.community.community_view.community.description}
|
|
/>
|
|
{/if}
|
|
<meta name="og:url" content={$page.url.toString()} />
|
|
</svelte:head>
|
|
|
|
<div class="flex flex-col md:flex-row gap-4 w-full">
|
|
<div class="md:hidden">
|
|
<details>
|
|
<summary class="flex flex-row">
|
|
<div
|
|
class="{Color.secondary} px-3 py-1 transition-colors text-sm
|
|
rounded-md cursor-pointer mb-1"
|
|
>
|
|
Sidebar
|
|
</div>
|
|
</summary>
|
|
<CommunityCard community_view={data.community.community_view} />
|
|
</details>
|
|
</div>
|
|
<div class="flex flex-col gap-4 max-w-full w-full">
|
|
<div class="flex flex-col sm:flex-row gap-4 max-w-full w-full">
|
|
<MultiSelect
|
|
options={['Active', 'Hot', 'TopAll', 'New']}
|
|
optionNames={['Active', 'Hot', 'Top', 'New']}
|
|
selected={$page.url.searchParams.get('sort') ?? 'Active'}
|
|
on:select={(e) => {
|
|
const url = $page.url
|
|
url.searchParams.set('sort', e.detail)
|
|
url.searchParams.delete('page')
|
|
goto(url, {
|
|
invalidateAll: true,
|
|
})
|
|
}}
|
|
/>
|
|
</div>
|
|
{#each data.posts.posts as post}
|
|
<Post {post} />
|
|
{/each}
|
|
<Button
|
|
on:click={() => {
|
|
$page.url.searchParams.set(
|
|
'page',
|
|
((Number($page.url.searchParams.get('page')) || 1) + 1).toString()
|
|
)
|
|
|
|
goto($page.url.toString(), {
|
|
invalidateAll: true,
|
|
})
|
|
}}
|
|
>
|
|
Next
|
|
</Button>
|
|
</div>
|
|
<div class="hidden md:block">
|
|
<CommunityCard community_view={data.community.community_view} />
|
|
</div>
|
|
</div>
|