From 15ed5248ce60903bdcba56f7fe09a57836533bd0 Mon Sep 17 00:00:00 2001 From: James Xylight Date: Wed, 25 Jun 2025 16:59:11 -0700 Subject: [PATCH] fix: add messages placeholder, close #552 --- src/lib/i18n/en.json | 5 +++- src/routes/inbox/messages/+page.svelte | 37 +++++++++++++++++--------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 34a2d154..2a25b81e 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -313,7 +313,10 @@ "messages": { "conversation": "This is the beginning of your conversation with {{user}}", "indicator": "Messaging {{user}}", - "start": "Start chat" + "start": "Start chat", + "empty": { + "title": "No messages" + } } }, "moderation": { diff --git a/src/routes/inbox/messages/+page.svelte b/src/routes/inbox/messages/+page.svelte index 201a33fc..e279f2ed 100644 --- a/src/routes/inbox/messages/+page.svelte +++ b/src/routes/inbox/messages/+page.svelte @@ -7,12 +7,13 @@ import Skeleton from '$lib/components/ui/generic/Skeleton.svelte' import Header from '$lib/components/ui/layout/pages/Header.svelte' import Pageination from '$lib/components/ui/Pageination.svelte' + import Placeholder from '$lib/components/ui/Placeholder.svelte' import { publishedToDate } from '$lib/components/util/date.js' import RelativeDate from '$lib/components/util/RelativeDate.svelte' import { t } from '$lib/i18n/translations.js' import type { Person, PrivateMessageView } from 'lemmy-js-client' import { Button, Modal } from 'mono-svelte' - import { ChatBubbleOvalLeftEllipsis, Icon } from 'svelte-hero-icons' + import { ChatBubbleOvalLeftEllipsis, Icon, Inbox } from 'svelte-hero-icons' import { expoOut } from 'svelte/easing' import { fly } from 'svelte/transition' @@ -85,18 +86,19 @@ /> -
+{#snippet startChat()} + +{/snippet} + +
{$t('filter.inbox.messages')} - {#snippet extended()} - - {/snippet}
{#await data.messages}
@@ -119,8 +121,17 @@ {@const previews = conversationPreviews(conversations)}
    + {#if previews.length == 0} + + {@render startChat?.()} + + {/if} {#each previews as preview, index (preview)}