[feat] fix list update + add dark mode and switch
This commit is contained in:
@@ -35,6 +35,7 @@
|
|||||||
"framer-motion": "^12.5.0",
|
"framer-motion": "^12.5.0",
|
||||||
"jotai": "^2.12.2",
|
"jotai": "^2.12.2",
|
||||||
"next": "15.2.0",
|
"next": "15.2.0",
|
||||||
|
"next-themes": "^0.4.6",
|
||||||
"react": "^19.0.0",
|
"react": "^19.0.0",
|
||||||
"react-dom": "^19.0.0",
|
"react-dom": "^19.0.0",
|
||||||
"tauri-plugin-valtio": "1.1.1",
|
"tauri-plugin-valtio": "1.1.1",
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"permissions": {
|
"permissions": {
|
||||||
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ```",
|
"description": "List of permissions attached to this capability.\n\nMust include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. For commands directly implemented in the application itself only `${permission-name}` is required.\n\n## Example\n\n```json [ \"core:default\", \"shell:allow-open\", \"dialog:open\", { \"identifier\": \"fs:allow-write-text-file\", \"allow\": [{ \"path\": \"$HOME/test.txt\" }] } ] ```",
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"$ref": "#/definitions/PermissionEntry"
|
"$ref": "#/definitions/PermissionEntry"
|
||||||
@@ -5598,6 +5598,211 @@
|
|||||||
"description": "Denies the values command without any pre-configured scope.",
|
"description": "Denies the values command without any pre-configured scope.",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"const": "store:deny-values"
|
"const": "store:deny-values"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Default permissions for tauri-plugin-valtio.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the clear_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-clear-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_default_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-default-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_ids command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-ids"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_store_state command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-store-state"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the get_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-get-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the load command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-load"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the patch command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-patch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_all_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-all-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_some command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-some"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the save_some_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-save-some-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_store_options command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-store-options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the set_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-set-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Enables the unload command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:allow-unload"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the clear_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-clear-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_default_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-default-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_ids command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-ids"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_store_state command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-store-state"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the get_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-get-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the load command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-load"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the patch command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-patch"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_all command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-all"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_all_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-all-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_some command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-some"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the save_some_now command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-save-some-now"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_autosave command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-autosave"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_save_strategy command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-save-strategy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_store_options command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-store-options"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the set_valtio_path command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-set-valtio-path"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Denies the unload command without any pre-configured scope.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "valtio:deny-unload"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ body {
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
|
||||||
Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
|
||||||
/* background: transparent; */
|
|
||||||
background: rgba(242, 241, 243, 0.65);
|
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export default function RootLayout({
|
|||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body>
|
<body className="bg-[rgba(242, 241, 243, 0.65)] dark:bg-zinc-900">
|
||||||
<Providers>{children}</Providers>
|
<Providers>{children}</Providers>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { HeroUIProvider } from "@heroui/react"
|
import { HeroUIProvider } from "@heroui/react"
|
||||||
import { ToastProvider } from "@heroui/toast"
|
import { ToastProvider } from "@heroui/toast"
|
||||||
|
import { ThemeProvider as NextThemesProvider } from "next-themes"
|
||||||
|
|
||||||
export default function Providers({ children }: { children: React.ReactNode }) {
|
export default function Providers({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<HeroUIProvider className="h-full bg-transparent">
|
<HeroUIProvider className="h-full bg-transparent">
|
||||||
<ToastProvider toastOffset={10} placement="top-center" />
|
<NextThemesProvider attribute="class" defaultTheme="light">
|
||||||
{children}
|
<ToastProvider toastOffset={10} placement="top-center" />
|
||||||
|
{children}
|
||||||
|
</NextThemesProvider>
|
||||||
</HeroUIProvider>
|
</HeroUIProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,15 +3,16 @@ import { Plus, SettingConfig, Switch } from "@icon-park/react"
|
|||||||
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
|
||||||
import { ToolButton } from "../window/ToolButton"
|
import { ToolButton } from "../window/ToolButton"
|
||||||
import { useSnapshot } from "valtio"
|
import { useSnapshot } from "valtio"
|
||||||
import { useEffect, useState } from "react"
|
import { use, useEffect, useState } from "react"
|
||||||
|
|
||||||
const LaunchOption = () => {
|
const LaunchOption = () => {
|
||||||
toolStore.start()
|
|
||||||
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
|
|
||||||
const [currentLaunchOption, setCurrentLaunchOption] = useState(launchOptions[0])
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setCurrentLaunchOption(launchOptions[launchIndex] || '')
|
;async () => {
|
||||||
}, [launchIndex])
|
toolStore.start()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const { launchOptions, launchIndex } = useSnapshot(toolStore.state)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
@@ -36,11 +37,10 @@ const LaunchOption = () => {
|
|||||||
<CardBody>
|
<CardBody>
|
||||||
<textarea
|
<textarea
|
||||||
placeholder="请输入启动选项"
|
placeholder="请输入启动选项"
|
||||||
value={currentLaunchOption}
|
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"
|
className="w-full font-mono text-base bg-transparent outline-none resize-none min-h-20"
|
||||||
/>
|
/>
|
||||||
<p>{launchIndex}</p>
|
|
||||||
</CardBody>
|
</CardBody>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ interface CardProps {
|
|||||||
const Card = ({ children }: CardProps) => {
|
const Card = ({ children }: CardProps) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<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
|
data-tauri-drag-region
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
@@ -2,13 +2,16 @@
|
|||||||
import { resetAppStore } from "@/store/app"
|
import { resetAppStore } from "@/store/app"
|
||||||
import { resetToolStore } from "@/store/tool"
|
import { resetToolStore } from "@/store/tool"
|
||||||
import { addToast } from "@heroui/react"
|
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 { 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 { platform } from "@tauri-apps/plugin-os"
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
|
|
||||||
const Nav = () => {
|
const Nav = () => {
|
||||||
|
const { theme, setTheme } = useTheme()
|
||||||
|
|
||||||
const close = async () => {
|
const close = async () => {
|
||||||
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
||||||
await exit()
|
await exit()
|
||||||
@@ -62,6 +65,14 @@ const Nav = () => {
|
|||||||
<RocketOne size={16} />
|
<RocketOne size={16} />
|
||||||
</button>
|
</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" && ( */}
|
{/* { platform() === "windows" && ( */}
|
||||||
<>
|
<>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -2,7 +2,11 @@ import { store } from 'tauri-plugin-valtio';
|
|||||||
import { DEFAULT_STORE_CONFIG } from '.';
|
import { DEFAULT_STORE_CONFIG } from '.';
|
||||||
|
|
||||||
const defaultValue = {
|
const defaultValue = {
|
||||||
launchOptions: [] as string[],
|
launchOptions: [
|
||||||
|
"-novid -high -freq 144 -fullscreen",
|
||||||
|
"-novid -high -w 1920 -h 1080 -freq 144 -sw -noborder",
|
||||||
|
"-novid -high -freq 144 -fullscreen -allow_third_party_software"
|
||||||
|
] as string[],
|
||||||
launchIndex: 0,
|
launchIndex: 0,
|
||||||
powerPlan: 0
|
powerPlan: 0
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user