Add toasts..... such as they are

This commit is contained in:
2025-01-12 00:09:27 +01:00
parent 1b58c1159b
commit 2788afe822
2 changed files with 30 additions and 5 deletions

View File

@@ -66,7 +66,22 @@ toast('Hello World', {
<Toaster hotkey={['KeyC']} />
-->
<svelte:window on:keydown={keyDown} />
<Toaster theme="dark" expand visibleToasts={9} />
<Toaster
theme="dark"
expand
visibleToasts={9}
position="bottom-center"
offset="40px"
closeButton
richColors
toastOptions={{
classes: {
toast: 'min-w-[600px] p-4',
title: 'text-lg font-bold',
description: 'text-base'
}
}}
/>
<template>
<Header />
<main class="flex-1">

View File

@@ -21,15 +21,25 @@
const res = await UpdateAddon(addon.name);
if (res.error) {
console.error(res.error);
toast.error(`Failed to update ${addon.name}`);
toast.error(`Failed to update ${addon.name}`, {
classes: {
toast: 'bg-red-600'
}
});
} else {
if (res.data) {
toast.warning(`${addon.name} updated with breaking changes!`, {
duration: 5000
toast.error(`${addon.name} updated with breaking changes!`, {
classes: {
toast: 'bg-red-600'
},
description: 'Please restart your game to apply the update.'
});
} else {
toast.success(`${addon.name} updated successfully!`, {
duration: 3000
classes: {
toast: 'bg-green-600'
},
description: 'You may /reload ingame to apply the update.'
});
}
}