impr: add view select to community page

This commit is contained in:
James Xylight committed 2025-07-11 11:20:06 -07:00
1 parent 3b00845806
commit 020b0080a5
1 file changed
+14 -12
+14 -12
View File
@@ -5,6 +5,7 @@
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte' import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte' import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte' import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte' import PostFeed from '$lib/components/lemmy/post/feed/PostFeed.svelte'
import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte' import VirtualFeed from '$lib/components/lemmy/post/feed/VirtualFeed.svelte'
import Header from '$lib/components/ui/layout/pages/Header.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte'
@@ -61,8 +62,7 @@
</Modal> </Modal>
{/if} {/if}
<div class="flex flex-col gap-4 max-w-full w-full min-w-0"> <Header pageHeader>
<Header pageHeader>
<div class="flex flex-col w-full"> <div class="flex flex-col w-full">
<CommunityHeader <CommunityHeader
bind:community={data.community.value.community_view.community} bind:community={data.community.value.community_view.community}
@@ -74,11 +74,14 @@
/> />
</div> </div>
{#snippet extended()} {#snippet extended()}
<div class="flex flex-row gap-2">
<Sort selected={data.sort} /> <Sort selected={data.sort} />
<ViewSelect showLabel />
</div>
{/snippet} {/snippet}
</Header> </Header>
{#if profile.data.user} {#if profile.data.user}
{#if !data.community.value.discussion_languages.every( l => profile.data.user?.discussion_languages.includes(l), ) && profile.data.user.discussion_languages.length > 0} {#if !data.community.value.discussion_languages.every( l => profile.data.user?.discussion_languages.includes(l), ) && profile.data.user.discussion_languages.length > 0}
{@const missing = data.community.value.discussion_languages.filter( {@const missing = data.community.value.discussion_languages.filter(
i => !profile.data.user?.discussion_languages.includes(i), i => !profile.data.user?.discussion_languages.includes(i),
@@ -112,9 +115,9 @@
{/if} {/if}
</div> </div>
{/if} {/if}
{/if} {/if}
{#if data.community.value.community_view.blocked} {#if data.community.value.community_view.blocked}
<Placeholder <Placeholder
icon={XMark} icon={XMark}
title="Blocked" title="Blocked"
@@ -127,7 +130,7 @@
Blocked Communities Blocked Communities
</Button> </Button>
</Placeholder> </Placeholder>
{:else} {:else}
{@const SvelteComponent = browser ? VirtualFeed : PostFeed} {@const SvelteComponent = browser ? VirtualFeed : PostFeed}
<SvelteComponent <SvelteComponent
posts={data.posts.posts} posts={data.posts.posts}
@@ -135,12 +138,12 @@
feedId="community" feedId="community"
community community
/> />
{/if} {/if}
<svelte:element <svelte:element
this={settings.infiniteScroll ? 'noscript' : 'div'} this={settings.infiniteScroll ? 'noscript' : 'div'}
class="mt-auto" class="mt-auto"
> >
<Pageination <Pageination
page={data.page} page={data.page}
cursor={{ next: data.cursor.next }} cursor={{ next: data.cursor.next }}
@@ -154,8 +157,7 @@
})} })}
</span> </span>
</Pageination> </Pageination>
</svelte:element> </svelte:element>
</div>
<style> <style>
</style> </style>