From ed7db1dd4170f992d51bc39563b95016b095cf42 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Wed, 22 Jan 2025 09:38:44 -0800 Subject: [PATCH] enh: 'notification' event type --- src/lib/components/chat/Chat.svelte | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index ff9b47bfd..7142047be 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -321,6 +321,19 @@ eventConfirmationMessage = data.message; eventConfirmationInputPlaceholder = data.placeholder; eventConfirmationInputValue = data?.value ?? ''; + } else if (type === 'notification') { + const toastType = data?.type ?? 'info'; + const toastContent = data?.content ?? ''; + + if (toastType === 'success') { + toast.success(toastContent); + } else if (toastType === 'error') { + toast.error(toastContent); + } else if (toastType === 'warning') { + toast.warning(toastContent); + } else { + toast.info(toastContent); + } } else { console.log('Unknown message type', data); }