From fb869e767b0c5ba36f30f3e2f9567371f8ceac4b Mon Sep 17 00:00:00 2001 From: h Date: Wed, 28 Oct 2026 01:56:19 +0000 Subject: [PATCH] refactor(frontend): saved and transcription results show where they were asked, not in a toast --- .../src/lib/components/MessageBubble.svelte | 13 +++-- .../src/lib/components/SavedComposer.svelte | 34 ++++++++++-- frontend/src/lib/components/SavedItem.svelte | 53 +++++++++++++++++++ .../src/lib/components/media/VideoNote.svelte | 7 +++ .../lib/components/media/VoiceMessage.svelte | 7 +++ frontend/src/lib/media/transcript.svelte.ts | 7 +-- frontend/src/lib/stores/saved.svelte.ts | 42 +++++++-------- 7 files changed, 127 insertions(+), 36 deletions(-) create mode 100644 frontend/src/lib/components/SavedItem.svelte diff --git a/frontend/src/lib/components/MessageBubble.svelte b/frontend/src/lib/components/MessageBubble.svelte index 462d30c..d246a7c 100644 --- a/frontend/src/lib/components/MessageBubble.svelte +++ b/frontend/src/lib/components/MessageBubble.svelte @@ -12,6 +12,7 @@ import Reactions from "#lib/components/Reactions.svelte"; import ReplyHeader from "#lib/components/ReplyHeader.svelte"; import MessageReadItem from "#lib/components/read/MessageReadItem.svelte"; + import SavedItem from "#lib/components/SavedItem.svelte"; import Avatar from "#lib/components/ui/Avatar.svelte"; import ContextMenu from "#lib/components/ui/ContextMenu.svelte"; import ContextMenuItem from "#lib/components/ui/ContextMenuItem.svelte"; @@ -333,13 +334,11 @@ > {/if} {#if savedUi.available && !savedUi.isSavedChat(message.chat_id)} - savedUi.forward(message.chat_id, message.message_id)} - >{message.deleted_at || message.is_self_destruct - ? t("saved.copy") - : t("saved.forward")} + {/if} (null); let file = $state(null); let caption = $state(""); let voice = $state(false); @@ -49,11 +50,13 @@ return; } sending = true; - if (await savedUi.send({ text: message })) { + const result = await savedUi.send({ text: message }); + sending = false; + failure = result.ok ? null : t(result.label); + if (result.ok) { text = ""; requestAnimationFrame(fit); } - sending = false; } async function sendFile() { @@ -61,13 +64,14 @@ return; } sending = true; - const sent = await savedUi.send({ + const result = await savedUi.send({ file, text: caption.trim(), voice: isAudio && voice, }); sending = false; - if (sent) { + failure = result.ok ? null : t(result.label); + if (result.ok) { file = null; caption = ""; } @@ -97,6 +101,7 @@ function onOpenChange(open: boolean) { if (!(open || sending)) { + failure = null; if (!text) { text = caption; } @@ -108,6 +113,9 @@
+ {#if failure && !file} +

{failure}

+ {/if}