feat: add profile page filtering

This commit is contained in:
Xyphyn committed 2023-07-27 12:48:43 -07:00
1 parent 575662ae2c
commit 53ef843cde
2 files changed
+30 -11

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
import type { MyUserInfo } from 'lemmy-js-client'
export const isMod = (me: MyUserInfo, community: number) =>
me.moderates.map((c) => c.community.id).includes(community)
export const isAdmin = (me: MyUserInfo) => me.local_user_view.person.admin
+24 -11
View File
@@ -77,17 +77,30 @@
<div class="flex flex-col-reverse lg:flex-row gap-4 max-w-full w-full">
<div class="flex flex-col gap-4 max-w-full w-full">
<MultiSelect
options={['New', 'TopAll']}
optionNames={['New', 'Top']}
selected={data.sort}
on:select={(e) => {
$page.url.searchParams.set('sort', e.detail)
goto($page.url.toString(), {
invalidateAll: true,
})
}}
/>
<div class="flex flex-row gap-4 flex-wrap">
<MultiSelect
options={['New', 'TopAll']}
optionNames={['New', 'Top']}
selected={data.sort}
on:select={(e) => {
$page.url.searchParams.set('sort', e.detail)
goto($page.url.toString(), {
invalidateAll: true,
})
}}
/>
<MultiSelect
options={['all', 'posts', 'comments']}
optionNames={['All', 'Posts', 'Comments']}
selected={data.type}
on:select={(e) => {
$page.url.searchParams.set('type', e.detail)
goto($page.url.toString(), {
invalidateAll: true,
})
}}
/>
</div>
{#each data.items as item (item.counts.id)}
{#if isComment(item) && (data.type == 'all' || data.type == 'comments')}
<CommentItem comment={item} />