Browse Source

enh: 'notification' event type

Timothy Jaeryang Baek 3 months ago
parent
commit
ed7db1dd41
1 changed files with 13 additions and 0 deletions
  1. 13 0
      src/lib/components/chat/Chat.svelte

+ 13 - 0
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);
 				}