diff --git a/src/routes/inbox/+page.svelte b/src/routes/inbox/+page.svelte index 24d180f2..23259f99 100644 --- a/src/routes/inbox/+page.svelte +++ b/src/routes/inbox/+page.svelte @@ -1,7 +1,7 @@ -{#if data.items} +
+

Reports

+ { + $page.url.searchParams.delete('page') + $page.url.searchParams.set('type', e.detail) + goto($page.url.toString(), { + invalidateAll: true, + }) + }} + /> +
+{#if data.items && data.items.length > 0}
{#each data.items as item}
@@ -28,4 +47,14 @@
{/each}
+{:else} +
+ +
+

No reports

+

You're all caught up!

+
+
{/if} diff --git a/src/routes/moderation/+page.ts b/src/routes/moderation/+page.ts index f733d790..640b6ea2 100644 --- a/src/routes/moderation/+page.ts +++ b/src/routes/moderation/+page.ts @@ -2,11 +2,19 @@ import { authData, getClient } from '$lib/lemmy.js' import { getItemPublished } from '$lib/lemmy/item.js' import { get } from 'svelte/store' +type ReportListType = 'unread' | 'all' +type ReportFilter = 'all' | 'posts' | 'comments' | 'messages' + export async function load({ url }) { const page = Number(url.searchParams.get('page')) || 1 + const type: ReportListType = + (url.searchParams.get('type') as ReportListType) || 'unread' + const filter: ReportFilter = + (url.searchParams.get('filter') as ReportFilter) || 'all' + const jwt = get(authData)?.token - if (!jwt) return { page: page } + if (!jwt) return { type: type, page: page } // can they like // make a sane, consistent, and simple API for once @@ -15,13 +23,13 @@ export async function load({ url }) { // the interfaces don't even extend each other // meaning I have to make a separate function to get dates // for EACH FREAKING ITEM KAJSHDAWLD auwdi awiody - const client = getClient() const params = { auth: jwt, limit: 20, page: page, + unresolved_only: type == 'unread', } const [posts, comments, messages] = await Promise.all([ @@ -45,6 +53,7 @@ export async function load({ url }) { ) return { + type: type, page: page, items: everything, }