diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 1bcd6fbc83..4501d4a177 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -47,6 +47,7 @@ "svelte-exmarkdown": "^3.0.3", "svelte-infinite-loading": "^1.3.8", "svelte-portal": "^2.2.1", + "svelte-sonner": "^0.3.22", "svelte-tiny-virtual-list": "^2.0.5", "tailwind-merge": "^1.13.2", "vscode": "npm:@codingame/monaco-vscode-api@>=1.83.5 <1.84.0", @@ -78,7 +79,6 @@ "@types/vscode": "^1.83.5", "@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/parser": "^5.60.0", - "@zerodevx/svelte-toast": "^0.9.5", "autoprefixer": "^10.4.13", "cssnano": "^6.0.1", "d3-dag": "^0.11.5", @@ -2198,15 +2198,6 @@ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" }, - "node_modules/@zerodevx/svelte-toast": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@zerodevx/svelte-toast/-/svelte-toast-0.9.5.tgz", - "integrity": "sha512-JLeB/oRdJfT+dz9A5bgd3Z7TuQnBQbeUtXrGIrNWMGqWbabpepBF2KxtWVhL2qtxpRqhae2f6NAOzH7xs4jUSw==", - "dev": true, - "peerDependencies": { - "svelte": "^3.57.0 || ^4.0.0" - } - }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -9522,6 +9513,14 @@ "integrity": "sha512-P29PNqHld+SiaDuHzf98rLvhSYWXb3TVL9p7U5RG9UX8emUgypZgp9zuIIwpmIXysGQC6JG8duMc5FuaPnSVdg==", "dev": true }, + "node_modules/svelte-sonner": { + "version": "0.3.22", + "resolved": "https://registry.npmjs.org/svelte-sonner/-/svelte-sonner-0.3.22.tgz", + "integrity": "sha512-1AEBl7rTP4oeMAmBmkcvoHNOwB8gPzz73RYApcY8pyDwbjBewU8ATnXV8N42omV1sQvtSX/X0o5A1nfkN3T6cg==", + "peerDependencies": { + "svelte": ">=3 <5" + } + }, "node_modules/svelte-splitpanes": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/svelte-splitpanes/-/svelte-splitpanes-0.8.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 038790f4e3..5d2080ccb8 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -34,7 +34,6 @@ "@types/vscode": "^1.83.5", "@typescript-eslint/eslint-plugin": "^5.59.8", "@typescript-eslint/parser": "^5.60.0", - "@zerodevx/svelte-toast": "^0.9.5", "autoprefixer": "^10.4.13", "cssnano": "^6.0.1", "d3-dag": "^0.11.5", @@ -127,6 +126,7 @@ "svelte-exmarkdown": "^3.0.3", "svelte-infinite-loading": "^1.3.8", "svelte-portal": "^2.2.1", + "svelte-sonner": "^0.3.22", "svelte-tiny-virtual-list": "^2.0.5", "tailwind-merge": "^1.13.2", "vscode": "npm:@codingame/monaco-vscode-api@>=1.83.5 <1.84.0", diff --git a/frontend/src/lib/components/Toast.svelte b/frontend/src/lib/components/Toast.svelte index 3b1382ccf6..402786ce0e 100644 --- a/frontend/src/lib/components/Toast.svelte +++ b/frontend/src/lib/components/Toast.svelte @@ -1,79 +1,47 @@ -
-
-
-
- {#if error} - - {:else} - - {/if} -
-
-

{message}

- {#if errorMessage} -

- {errorMessage} -

- {/if} -
- -
- -
-
-
+
+
+

{message}

+ {#if errorMessage} +

+ {errorMessage} +

+ {/if} +
+ {#if actions.length > 0} +
{#each actions as action, index (index)} {/each}
-
+ {/if}
diff --git a/frontend/src/lib/toast.ts b/frontend/src/lib/toast.ts index 6f37988d87..c88f8a9b0f 100644 --- a/frontend/src/lib/toast.ts +++ b/frontend/src/lib/toast.ts @@ -1,6 +1,5 @@ import Toast from '$lib/components/Toast.svelte' -import { toast } from '@zerodevx/svelte-toast' - +import { toast } from 'svelte-sonner' export type ToastAction = { label: string callback: () => void @@ -13,23 +12,19 @@ export function sendUserToast( errorMessage: string | undefined = undefined, duration: number = 5000 ): void { - toast.push({ - component: { - src: Toast, - props: { - message, - error, - actions, - errorMessage, - duration - }, - sendIdTo: 'toastId' - }, - dismissable: false, - initial: 0, - theme: { - '--toastPadding': '0', - '--toastMsgPadding': '0' + function onClose() { + toast.dismiss(toastId) + } + + const props = { + componentProps: { + message, + actions, + errorMessage, + duration, + onClose } - }) + } + + const toastId = error ? toast.error(Toast, props) : toast.info(Toast, props) } diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index 63269d9375..e906111432 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -1,20 +1,8 @@ @@ -31,7 +19,7 @@
- +