[feat] auto start feature

This commit is contained in:
Purp1e
2025-03-23 23:25:28 +08:00
parent 88e55fa8ef
commit 6613174241
12 changed files with 157 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
"use client"
import { useAppStore } from "@/store/app"
import { Switch } from "@heroui/react"
import { enable, isEnabled, disable } from "@tauri-apps/plugin-autostart"
export default function Page() {
const app = useAppStore()
@@ -8,9 +10,20 @@ export default function Page() {
<div className="flex flex-col items-start gap-3 pt-2 pb-1">
<p>{app.state.version}</p>
<p>{app.state.hasUpdate ? "有" : "无"}</p>
<p>{app.state.inited ? "是" : "否"}</p>
<p>{app.state.notice}</p>
<p>使{app.state.useMirror ? "是" : "否"}</p>
<Switch
// checked={() => isEnabled()}
size="sm"
onChange={(e) => {
if (e.target.checked) {
enable()
} else {
disable()
}
}}
>
</Switch>
</div>
)
}