[feat] better store saving logic + more launch options
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { setLaunchIndex, setLaunchOption, toolStore } from "@/store/tool"
|
||||
import { addLaunchOption, setLaunchIndex, setLaunchOption, toolStore } from "@/store/tool"
|
||||
import { Plus, SettingConfig, Switch } from "@icon-park/react"
|
||||
import { useSnapshot } from "valtio"
|
||||
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
||||
@@ -15,10 +15,12 @@ const LaunchOption = () => {
|
||||
<SettingConfig /> 启动选项
|
||||
</CardIcon>
|
||||
<CardTool>
|
||||
<ToolButton onClick={() => setLaunchIndex(0)}>1</ToolButton>
|
||||
<ToolButton onClick={() => setLaunchIndex(1)}>2</ToolButton>
|
||||
<ToolButton onClick={() => setLaunchIndex(2)}>3</ToolButton>
|
||||
<ToolButton>
|
||||
{launchOptions.map((option, index) => (
|
||||
<ToolButton key={index} onClick={() => setLaunchIndex(index)}>
|
||||
{index+1}
|
||||
</ToolButton>
|
||||
))}
|
||||
<ToolButton onClick={() => addLaunchOption("")}>
|
||||
<Plus />
|
||||
添加
|
||||
</ToolButton>
|
||||
@@ -32,9 +34,7 @@ const LaunchOption = () => {
|
||||
<textarea
|
||||
placeholder="请输入启动选项"
|
||||
value={launchOptions[launchIndex] || ""}
|
||||
onChange={(e) =>
|
||||
launchIndex !== -1 && setLaunchOption(e.target.value, launchIndex)
|
||||
}
|
||||
onChange={(e) => launchIndex !== -1 && setLaunchOption(e.target.value, launchIndex)}
|
||||
className="w-full font-mono text-base bg-transparent outline-none resize-none min-h-20"
|
||||
/>
|
||||
</CardBody>
|
||||
|
||||
@@ -16,19 +16,19 @@ import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
||||
import { useTheme } from "next-themes"
|
||||
// import { platform } from "@tauri-apps/plugin-os"
|
||||
import { usePathname, useRouter } from "next/navigation"
|
||||
import { saveAll } from "tauri-plugin-valtio"
|
||||
import { saveAllNow } from "tauri-plugin-valtio"
|
||||
|
||||
const Nav = () => {
|
||||
const { theme, setTheme } = useTheme()
|
||||
|
||||
const close = async () => {
|
||||
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
||||
await saveAll()
|
||||
await saveAllNow()
|
||||
await exit()
|
||||
}
|
||||
|
||||
const minimize = async () => {
|
||||
await saveAll()
|
||||
await saveAllNow()
|
||||
await getCurrentWindow().minimize()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user