generated from dave/wails-template
Add toasts..... such as they are
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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.'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user