diff --git a/src/config/config.js b/src/config/config.js index 0943e8ff2..1917e7504 100644 --- a/src/config/config.js +++ b/src/config/config.js @@ -90,7 +90,7 @@ export const PDF_SIZE_LIMIT_READABLE = "500 MB"; export const DOCUMENT_SIZE_LIMIT = 27262976; export const DOCUMENT_SIZE_LIMIT_READABLE = "25 MB"; -export const TOAST_LENGTH = 2500; +export const TOAST_LENGTH = 3000; export const TOAST_FADE = 800; export const LEGACY_CUT_OFF = 20000000; diff --git a/src/lib/components/common/Toast.svelte b/src/lib/components/common/Toast.svelte index 9b5d8e711..cab532adb 100644 --- a/src/lib/components/common/Toast.svelte +++ b/src/lib/components/common/Toast.svelte @@ -81,7 +81,7 @@ .toast { padding: 0.5rem 0.5rem; border-radius: 0.5rem; - box-shadow: var(--shadow-3); + box-shadow: var(--shadow-2); display: inline-flex; align-items: flex-start; width: 100%; diff --git a/src/lib/components/layouts/Toaster.svelte b/src/lib/components/layouts/Toaster.svelte index 0bd2a88f2..bfdc936af 100644 --- a/src/lib/components/layouts/Toaster.svelte +++ b/src/lib/components/layouts/Toaster.svelte @@ -15,18 +15,28 @@ contents: ToastContents; } - function addToast(newToast: ToastItem, prev: ToastItem[]) { - const id = Date.now(); - return [...prev, { ...newToast, id }]; - } - export const toasts = writable([]); export function toast

( contents: ToastContents, options: ToastOptions

= {}, - ) { - toasts.update((prev) => addToast({ contents, ...options }, prev)); + ): number { + const newToast = { id: Date.now(), contents, ...options }; + toasts.update((prev) => [...prev, newToast]); + // Return the ID so we can update the toast later + return newToast.id; + } + + export function updateToast

( + id: number, + contents: ToastContents, + options: ToastOptions

= {}, + ): void { + toasts.update((prev) => + prev.map((toast) => + toast.id === id ? { ...toast, contents, ...options } : toast, + ), + ); }