feat: add unread filters to inbox and reports

This commit is contained in:
Xyphyn committed 2023-07-29 13:09:40 -07:00
1 parent d65c62d2d9
commit 1c9661546c
4 files changed
+81 -20

No files matched your search

+30 -1
View File
@@ -3,11 +3,30 @@
import Card from '$lib/components/ui/Card.svelte'
import { fly } from 'svelte/transition'
import Report from './Report.svelte'
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
import { page } from '$app/stores'
import { goto } from '$app/navigation'
import { EnvelopeOpen, Icon } from 'svelte-hero-icons'
export let data
</script>
{#if data.items}
<div class="mb-4 flex flex-col gap-4">
<h1 class="font-black text-3xl">Reports</h1>
<MultiSelect
selected={data.type}
options={['all', 'unread']}
optionNames={['All', 'Unread']}
on:select={(e) => {
$page.url.searchParams.delete('page')
$page.url.searchParams.set('type', e.detail)
goto($page.url.toString(), {
invalidateAll: true,
})
}}
/>
</div>
{#if data.items && data.items.length > 0}
<div class="flex flex-col gap-4">
{#each data.items as item}
<div in:fly={{ y: -6, opacity: 0, duration: 500 }}>
@@ -28,4 +47,14 @@
</div>
{/each}
</div>
{:else}
<div
class="text-slate-600 dark:text-zinc-400 flex flex-col justify-center items-center py-8 gap-2"
>
<Icon src={EnvelopeOpen} size="48" />
<div>
<h1 class="font-bold text-3xl">No reports</h1>
<p class="mt-2 text-center">You're all caught up!</p>
</div>
</div>
{/if}