refactor: replace Toast with Sonner

This commit is contained in:
tao.chen
2026-09-02 10:10:41 +08:00
committed by tao.chen
parent 635d80e3cf
commit ed58344add
18 changed files with 126 additions and 320 deletions
@@ -8,7 +8,7 @@ import {
} from "../../../services/api";
import { useScriptWorkspaceStore } from "../../platform/state/scriptWorkspaceStore";
import { useUiStore } from "../../platform/state/uiStore";
import { toast } from "sonner";
type Notice = {
tone: "success" | "error" | "info";
@@ -65,7 +65,9 @@ function requireApi(): WorkspaceBoundApi {
}
function pushToast(notice: Notice) {
useUiStore.getState().pushToast(notice);
if (notice.tone === "error") toast.error(notice.message);
else if (notice.tone === "info") toast.info(notice.message);
else toast.success(notice.message);
}
function setApiOnline(online: boolean) {