fix: missing toast

This commit is contained in:
Huakun Shen 2025-01-11 19:32:35 -05:00
parent c9d5801d8c
commit 3b888351cf
4 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@
import "../app.css" import "../app.css"
import { ModeWatcher, ThemeWrapper } from "@kksh/svelte5" import { ModeWatcher, ThemeWrapper } from "@kksh/svelte5"
import { dev } from "$app/environment" import { dev } from "$app/environment"
import { Toaster } from "svelte-sonner"
onMount(() => { onMount(() => {
if (!dev) { if (!dev) {
@ -17,6 +18,7 @@
</script> </script>
<ModeWatcher /> <ModeWatcher />
<Toaster richColors closeButton />
<ThemeWrapper> <ThemeWrapper>
{@render children()} {@render children()}
</ThemeWrapper> </ThemeWrapper>

View File

@ -15,7 +15,6 @@
import { gsap } from "gsap" import { gsap } from "gsap"
import { Flip } from "gsap/Flip" import { Flip } from "gsap/Flip"
import { onDestroy, onMount } from "svelte" import { onDestroy, onMount } from "svelte"
import { toast, Toaster } from "svelte-sonner"
import * as shellx from "tauri-plugin-shellx-api" import * as shellx from "tauri-plugin-shellx-api"
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -101,7 +100,6 @@
<svelte:window on:keydown={globalKeyDownHandler} /> <svelte:window on:keydown={globalKeyDownHandler} />
<ViewTransition /> <ViewTransition />
<Toaster richColors closeButton />
<AppContext {appConfig} {appState}> <AppContext {appConfig} {appState}>
{@render children()} {@render children()}
</AppContext> </AppContext>

View File

@ -32,6 +32,7 @@
import { goto } from "$app/navigation" import { goto } from "$app/navigation"
import { ArrowBigUpIcon, CircleXIcon, EllipsisVerticalIcon, RefreshCcwIcon } from "lucide-svelte" import { ArrowBigUpIcon, CircleXIcon, EllipsisVerticalIcon, RefreshCcwIcon } from "lucide-svelte"
import { onMount } from "svelte" import { onMount } from "svelte"
import { toast } from "svelte-sonner"
let inputEle: HTMLInputElement | null = $state(null) let inputEle: HTMLInputElement | null = $state(null)
function onKeyDown(event: KeyboardEvent) { function onKeyDown(event: KeyboardEvent) {

View File

@ -81,6 +81,7 @@
.installFromTarballUrl(tarballUrl, installDir, installExtras) .installFromTarballUrl(tarballUrl, installDir, installExtras)
.then(() => toast.success(`Plugin ${ext.name} Installed`)) .then(() => toast.success(`Plugin ${ext.name} Installed`))
.then((loadedExt) => { .then((loadedExt) => {
console.log("loadedExt", loadedExt);
supabaseAPI.incrementDownloads({ supabaseAPI.incrementDownloads({
identifier: ext.identifier, identifier: ext.identifier,
version: ext.version version: ext.version
@ -89,6 +90,7 @@
showBtn.uninstall = true showBtn.uninstall = true
}) })
.catch((err) => { .catch((err) => {
console.error("err", err)
toast.error("Fail to install tarball", { description: err }) toast.error("Fail to install tarball", { description: err })
}) })
.finally(() => { .finally(() => {
@ -149,6 +151,7 @@
</script> </script>
<svelte:window on:keydown={handleKeydown} /> <svelte:window on:keydown={handleKeydown} />
<Button onclick={() => toast.success("Hello")}>Toast</Button>
<Button <Button
variant="outline" variant="outline"
size="icon" size="icon"