[feat] use heroui + setup persistore + setup toast

todo: fix launchoption problem
This commit is contained in:
Purp1e
2025-03-12 11:22:32 +08:00
parent 2ef6d2c298
commit 9103150562
27 changed files with 745 additions and 264 deletions

View File

@@ -1,5 +1,8 @@
"use client"
import { Close, Minus, RocketOne, Square } from "@icon-park/react"
import { resetAppStore } from "@/store/app"
import { resetToolStore } from "@/store/tool"
import { addToast } from "@heroui/react"
import { Close, Minus, Refresh, RocketOne, Square } from "@icon-park/react"
import { getCurrentWindow } from "@tauri-apps/api/window"
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
// import { platform } from "@tauri-apps/plugin-os"
@@ -35,16 +38,26 @@ const Nav = () => {
const pathname = usePathname()
return (
<nav
className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4"
data-tauri-drag-region
>
<nav className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4" data-tauri-drag-region>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() =>
pathname !== "/prepare" ? router.push("/prepare") : router.back()
}
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() => {
resetAppStore()
resetToolStore()
addToast({
title: "重置成功",
description: "已重置所有设置,请重新启动程序",
})
}}
>
<Refresh size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={() => (pathname !== "/prepare" ? router.push("/prepare") : router.back())}
>
<RocketOne size={16} />
</button>
@@ -53,21 +66,21 @@ const Nav = () => {
<>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={minimize}
>
<Minus size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={toggleMaximize}
>
<Square size={16} />
</button>
<button
type="button"
className="px-2 py-0 transition rounded hover:bg-zinc-200/80 active:scale-95"
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
onClick={close}
>
<Close size={16} />