[fix] building errors 2/3
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
|
import { addToast } from "@heroui/react"
|
||||||
import { FolderFocusOne } from "@icon-park/react"
|
import { FolderFocusOne } from "@icon-park/react"
|
||||||
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
|
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
|
||||||
import { addToast } from "@heroui/react"
|
|
||||||
|
|
||||||
interface RoundedButtonProps {
|
interface RoundedButtonProps {
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
@@ -31,13 +31,55 @@ const CommonDir = () => {
|
|||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardBody>
|
<CardBody>
|
||||||
<div className="flex gap-1.5">
|
<div className="flex gap-1.5">
|
||||||
<RoundedButton onClick={()=> {alert("hello")}}>Steam安装位置</RoundedButton>
|
<RoundedButton
|
||||||
<RoundedButton onClick={()=> {addToast({title: "CS2游戏目录"})}}>CS2游戏目录</RoundedButton>
|
onClick={() => {
|
||||||
<RoundedButton onClick={()=> {addToast({title: "地图文件"})}}>地图文件</RoundedButton>
|
alert("hello")
|
||||||
<RoundedButton onClick={()=> {addToast({title: "游戏CFG目录"})}}>游戏CFG目录</RoundedButton>
|
}}
|
||||||
<RoundedButton onClick={()=> {addToast({title: "个人CFG目录"})}}>个人CFG目录</RoundedButton>
|
>
|
||||||
<RoundedButton onClick={()=> {addToast({title: "完美平台录像"})}}>完美平台录像</RoundedButton>
|
Steam安装位置
|
||||||
<RoundedButton onClick={()=> {addToast({title: "5E平台录像"})}}>5E平台录像</RoundedButton>
|
</RoundedButton>
|
||||||
|
<RoundedButton
|
||||||
|
onClick={() => {
|
||||||
|
addToast({ title: "CS2游戏目录" })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
CS2游戏目录
|
||||||
|
</RoundedButton>
|
||||||
|
<RoundedButton
|
||||||
|
onClick={() => {
|
||||||
|
addToast({ title: "地图文件" })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
地图文件
|
||||||
|
</RoundedButton>
|
||||||
|
<RoundedButton
|
||||||
|
onClick={() => {
|
||||||
|
addToast({ title: "游戏CFG目录" })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
游戏CFG目录
|
||||||
|
</RoundedButton>
|
||||||
|
<RoundedButton
|
||||||
|
onClick={() => {
|
||||||
|
addToast({ title: "个人CFG目录" })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
个人CFG目录
|
||||||
|
</RoundedButton>
|
||||||
|
<RoundedButton
|
||||||
|
onClick={() => {
|
||||||
|
addToast({ title: "完美平台录像" })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
完美平台录像
|
||||||
|
</RoundedButton>
|
||||||
|
<RoundedButton
|
||||||
|
onClick={() => {
|
||||||
|
addToast({ title: "5E平台录像" })
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
5E平台录像
|
||||||
|
</RoundedButton>
|
||||||
</div>
|
</div>
|
||||||
</CardBody>
|
</CardBody>
|
||||||
</Card>
|
</Card>
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
import { addLaunchOption, setLaunchIndex, setLaunchOption, toolStore } from "@/store/tool"
|
import {
|
||||||
|
addLaunchOption,
|
||||||
|
setLaunchIndex,
|
||||||
|
setLaunchOption,
|
||||||
|
toolStore,
|
||||||
|
} from "@/store/tool"
|
||||||
import { Plus, SettingConfig, Switch } from "@icon-park/react"
|
import { Plus, SettingConfig, Switch } from "@icon-park/react"
|
||||||
|
import { useEffect, useState } from "react"
|
||||||
import { useSnapshot } from "valtio"
|
import { useSnapshot } from "valtio"
|
||||||
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 { useEffect, useState } from "react"
|
|
||||||
|
|
||||||
const LaunchOption = () => {
|
const LaunchOption = () => {
|
||||||
void toolStore.start()
|
void toolStore.start()
|
||||||
@@ -22,7 +27,7 @@ const LaunchOption = () => {
|
|||||||
</CardIcon>
|
</CardIcon>
|
||||||
<CardTool>
|
<CardTool>
|
||||||
{launchOptions.map((option, index) => (
|
{launchOptions.map((option, index) => (
|
||||||
<ToolButton key={index} onClick={() => setLaunchIndex(index)}>
|
<ToolButton key={option} onClick={() => setLaunchIndex(index)}>
|
||||||
{index + 1}
|
{index + 1}
|
||||||
</ToolButton>
|
</ToolButton>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
import { setTheme as setTauriTheme } from "@/hooks/tauri/theme"
|
||||||
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"
|
||||||
@@ -11,15 +12,18 @@ import {
|
|||||||
Square,
|
Square,
|
||||||
SunOne,
|
SunOne,
|
||||||
} from "@icon-park/react"
|
} from "@icon-park/react"
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window"
|
import { type Theme, getCurrentWindow } from "@tauri-apps/api/window"
|
||||||
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
||||||
import { useTheme } from "next-themes"
|
import { useTheme } from "next-themes"
|
||||||
// import { platform } from "@tauri-apps/plugin-os"
|
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
import { saveAllNow } from "tauri-plugin-valtio"
|
import { saveAllNow } from "tauri-plugin-valtio"
|
||||||
|
|
||||||
const Nav = () => {
|
const Nav = () => {
|
||||||
const { theme, setTheme } = useTheme()
|
const { theme, setTheme } = useTheme()
|
||||||
|
const setAppTheme = async (theme: Theme) => {
|
||||||
|
setTheme(theme)
|
||||||
|
await setTauriTheme(theme)
|
||||||
|
}
|
||||||
|
|
||||||
const close = async () => {
|
const close = async () => {
|
||||||
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
||||||
@@ -79,7 +83,7 @@ const Nav = () => {
|
|||||||
type="button"
|
type="button"
|
||||||
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
className="px-2 py-0 transition duration-150 rounded hover:bg-zinc-200/80 active:scale-95"
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
theme === "light" ? setTheme("dark") : setTheme("light")
|
theme === "light" ? setAppTheme("dark") : setAppTheme("light")
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{theme === "light" ? <SunOne size={16} /> : <Moon size={16} />}
|
{theme === "light" ? <SunOne size={16} /> : <Moon size={16} />}
|
||||||
|
|||||||
13
src/hooks/tauri/theme.ts
Normal file
13
src/hooks/tauri/theme.ts
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import { invoke } from "@tauri-apps/api/core"
|
||||||
|
|
||||||
|
type Theme = "auto" | "light" | "dark"
|
||||||
|
|
||||||
|
export async function getTheme() {
|
||||||
|
return invoke<Theme>("plugin:theme|get_theme")
|
||||||
|
}
|
||||||
|
|
||||||
|
export function setTheme(theme: Theme) {
|
||||||
|
return invoke("plugin:theme|set_theme", {
|
||||||
|
theme: theme,
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -42,10 +42,7 @@ export const addLaunchOption = (option: string) => {
|
|||||||
if (toolStore.state.launchOptions.length >= 10) {
|
if (toolStore.state.launchOptions.length >= 10) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
toolStore.state.launchOptions = [
|
toolStore.state.launchOptions = [...toolStore.state.launchOptions, option]
|
||||||
...toolStore.state.launchOptions,
|
|
||||||
option,
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const resetToolStore = () => {
|
export const resetToolStore = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user