diff --git a/bun.lockb b/bun.lockb index f4ff37f3..48d04088 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/lib/components/ui/Pageination.svelte b/src/lib/components/ui/Pageination.svelte index 5bf637d1..d0ce5459 100644 --- a/src/lib/components/ui/Pageination.svelte +++ b/src/lib/components/ui/Pageination.svelte @@ -61,7 +61,7 @@ rounding="pill" class="text-inherit dark:text-inherit disabled:opacity-20! disabled:bg-transparent!" disabled={(cursor?.back == undefined && cursor?.next != undefined) || - page <= 0} + page <= 1} data-sveltekit-preload-data="off" > {#snippet suffix()} diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 14ec12df..a1be48c3 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -309,7 +309,8 @@ }, "messages": { "conversation": "This is the beginning of your conversation with {{user}}", - "indicator": "Messaging {{user}}" + "indicator": "Messaging {{user}}", + "start": "Start chat" } }, "moderation": { diff --git a/src/routes/inbox/+page.ts b/src/routes/inbox/+page.ts index 4a867b42..4a3044d2 100644 --- a/src/routes/inbox/+page.ts +++ b/src/routes/inbox/+page.ts @@ -57,7 +57,7 @@ export async function load({ url, fetch }) { publishedToDate(a.published).getTime(), ) - const totalNotifs = data.filter(i => !i.read).length + const totalNotifs = type == 'all' ? data.filter(i => !i.read).length : 0 notifications.update(i => ({ applications: i.applications, diff --git a/src/routes/inbox/messages/+page.svelte b/src/routes/inbox/messages/+page.svelte index ce56a5f3..08a6ee56 100644 --- a/src/routes/inbox/messages/+page.svelte +++ b/src/routes/inbox/messages/+page.svelte @@ -1,12 +1,19 @@ + + + goto( + resolveRoute('/inbox/messages/[user_id]', { user_id: u.id.toString() }), + )} + /> + +
{$t('filter.inbox.messages')} + {#snippet extended()} + + {/snippet}
{#await data.messages} -
- +
+ {#each new Array(5) as _, index} + {_} +
+ +
+ {/each}
-{:then data} - {@const conversations = data.private_messages} +{:then res} + {@const conversations = res.private_messages} {@const previews = conversationPreviews(conversations)} + + {#if res.private_messages.length == 50 || data.page != 1} +
+ `/inbox/messages?page=${current}`} + /> +
+ {/if} {/await} diff --git a/src/routes/inbox/messages/+page.ts b/src/routes/inbox/messages/+page.ts index f78a2a57..0cfc803c 100644 --- a/src/routes/inbox/messages/+page.ts +++ b/src/routes/inbox/messages/+page.ts @@ -1,13 +1,17 @@ import { client } from '$lib/lemmy.svelte.js' import { awaitIfServer } from '$lib/promise.svelte.js' -export async function load({ fetch }) { +export async function load({ fetch, url }) { + const page = Number(url.searchParams.get('page') || '1') + // TODO probably add proper paging const messagePromise = client({ func: fetch }).getPrivateMessages({ limit: 50, + page: page, }) return { messages: (await awaitIfServer(messagePromise)).data, + page: page, } } diff --git a/src/routes/inbox/messages/[user_id=integer]/Message.svelte b/src/routes/inbox/messages/[user_id=integer]/Message.svelte index bd0e2ea0..8c2106fb 100644 --- a/src/routes/inbox/messages/[user_id=integer]/Message.svelte +++ b/src/routes/inbox/messages/[user_id=integer]/Message.svelte @@ -1,5 +1,7 @@