From 27876c1aaed8ea12e7704bb0f1d5ba093caa6b90 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Mon, 26 Feb 2024 13:17:24 -0800 Subject: [PATCH] style: revert notification margins --- .../lib/Dashboard/Visualization/Scene.svelte | 18 ++++----- client/src/lib/Notifications/notifications.ts | 40 ++----------------- 2 files changed, 11 insertions(+), 47 deletions(-) diff --git a/client/src/lib/Dashboard/Visualization/Scene.svelte b/client/src/lib/Dashboard/Visualization/Scene.svelte index d276160..198fc1e 100644 --- a/client/src/lib/Dashboard/Visualization/Scene.svelte +++ b/client/src/lib/Dashboard/Visualization/Scene.svelte @@ -145,13 +145,11 @@ - - - + diff --git a/client/src/lib/Notifications/notifications.ts b/client/src/lib/Notifications/notifications.ts index 097c2bb..3cf2338 100644 --- a/client/src/lib/Notifications/notifications.ts +++ b/client/src/lib/Notifications/notifications.ts @@ -25,41 +25,7 @@ export class Notifications { const sendToast = (duration: number) => { toast.success(message, { style: - 'padding: 25px; font-size: 1.5rem; background-color: #15803d; color: #fafafa; gap: 0.5rem; user-select: none; max-width: 70vw; margin-top: 30px;', - duration, - ...options, - }) - } - - if (options?.withAudio && options?.src) { - let sound: Howl - sound = new Howl({ - src: [options.src], - preload: true, - autoplay: true, - onload: () => { - let duration = sound.duration() * 1000 - sendToast(duration) - setTimeout(onComplete, duration) - }, - }) - } else { - sendToast(this.defaultDuration) - setTimeout(onComplete, this.defaultDuration) - } - } - public static error(message: string, options?: NotificationOptions) { - if (options?.withAudio && !options.src) - throw new Error('No audio source provided') - - const onComplete = () => { - if (options?.onComplete) options.onComplete() - } - - const sendToast = (duration: number) => { - toast.error(message, { - style: - 'padding: 25px; width-200px; font-size: 1.5rem; background-color: #dc2626; color: #fafafa; gap: 0.5rem; user-select: none; max-width: 70vw; margin-top: 30px;', + 'padding: 25px; font-size: 1.5rem; background-color: #15803d; color: #fafafa; gap: 0.5rem; user-select: none; max-width: 70vw;', duration, ...options, }) @@ -90,7 +56,7 @@ export class Notifications { const sendToast = (duration: number) => { toast(message, { style: - 'padding: 25px; font-size: 1.5rem; gap: 0.5rem; user-select: none; max-width-600px; max-width: 70vw; margin-top: 30px;', + 'padding: 25px; font-size: 1.5rem; gap: 0.5rem; user-select: none; max-width-600px; max-width: 70vw;', icon: InfoIcon, duration, ...options, @@ -121,7 +87,7 @@ export class Notifications { const sendToast = (duration: number) => { toast(message, { style: - 'padding: 25px; font-size: 1.5rem; background-color: #f59e0b; color: #fafafa; gap: 0.5rem; user-select: none; max-width: 70vw; margin-top: 30px;', + 'padding: 25px; font-size: 1.5rem; background-color: #f59e0b; color: #fafafa; gap: 0.5rem; user-select: none; max-width: 70vw;', icon: WarnIcon, duration, ...options,