[feat] fix list update + add dark mode and switch
This commit is contained in:
@@ -3,15 +3,16 @@ import { Plus, SettingConfig, Switch } from "@icon-park/react"
|
||||
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
||||
import { ToolButton } from "../window/ToolButton"
|
||||
import { useSnapshot } from "valtio"
|
||||
import { useEffect, useState } from "react"
|
||||
import { use, useEffect, useState } from "react"
|
||||
|
||||
const LaunchOption = () => {
|
||||
toolStore.start()
|
||||
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
|
||||
const [currentLaunchOption, setCurrentLaunchOption] = useState(launchOptions[0])
|
||||
useEffect(() => {
|
||||
setCurrentLaunchOption(launchOptions[launchIndex] || '')
|
||||
}, [launchIndex])
|
||||
;async () => {
|
||||
toolStore.start()
|
||||
}
|
||||
}, [])
|
||||
|
||||
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
|
||||
|
||||
return (
|
||||
<Card>
|
||||
@@ -36,11 +37,10 @@ const LaunchOption = () => {
|
||||
<CardBody>
|
||||
<textarea
|
||||
placeholder="请输入启动选项"
|
||||
value={currentLaunchOption}
|
||||
value={launchOptions[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"
|
||||
/>
|
||||
<p>{launchIndex}</p>
|
||||
</CardBody>
|
||||
</Card>
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ interface CardProps {
|
||||
const Card = ({ children }: CardProps) => {
|
||||
return (
|
||||
<div
|
||||
className="dark:from-black/10 dark:to-black/5 dark:border-white/[6%] px-3 pt-3 pb-4 flex flex-col gap-2.5 border w-full rounded-lg bg-white/40 border-black/[6%]"
|
||||
className="dark:bg-white/[3%] dark:border-white/[6%] px-3 pt-3 pb-4 flex flex-col gap-2.5 border w-full rounded-lg bg-white/40 border-black/[6%]"
|
||||
data-tauri-drag-region
|
||||
>
|
||||
{children}
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
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 { Close, Minus, Moon, Refresh, RefreshOne, RocketOne, Square, Sun, SunOne } from "@icon-park/react"
|
||||
import { useTheme } from "next-themes"
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window"
|
||||
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
||||
import { /* relaunch, */ exit, relaunch } from "@tauri-apps/plugin-process"
|
||||
// import { platform } from "@tauri-apps/plugin-os"
|
||||
import { usePathname, useRouter } from "next/navigation"
|
||||
|
||||
const Nav = () => {
|
||||
const { theme, setTheme } = useTheme()
|
||||
|
||||
const close = async () => {
|
||||
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
||||
await exit()
|
||||
@@ -62,6 +65,14 @@ const Nav = () => {
|
||||
<RocketOne size={16} />
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
||||
onClick={() => (theme === "light" ? setTheme("dark") : setTheme("light"))}
|
||||
>
|
||||
{theme === "light" ? <SunOne size={16} /> : <Moon size={16} />}
|
||||
</button>
|
||||
|
||||
{/* { platform() === "windows" && ( */}
|
||||
<>
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user