[feat] better store operation

This commit is contained in:
2025-03-17 11:48:30 +08:00
parent 47dc77732f
commit db3cf9aef2
15 changed files with 169 additions and 127 deletions

View File

@@ -12,8 +12,7 @@ import { usePathname, useRouter } from "next/navigation"
import type { ReactNode } from "react"
// import { platform } from "@tauri-apps/plugin-os"
import { appStore, setVersion } from "@/store/app"
import { useSnapshot } from "valtio"
import { useAppStore } from "@/store/app"
interface SideButtonProps {
route: string
@@ -71,8 +70,7 @@ const Avatar = () => {
}
const SideBar = () => {
void appStore.start()
const { version } = useSnapshot(appStore.state)
const app = useAppStore()
return (
<div
@@ -119,9 +117,9 @@ const SideBar = () => {
variant="light"
size="sm"
className="mt-0.5 text-zinc-600"
onPress={() => setVersion("x.y.z")}
onPress={() => app.setVersion("x.y.z")}
>
{version}
{app.state.version}
</Button>
</div>
</div>