[fix] building errors 2/3

This commit is contained in:
2025-03-14 19:13:32 +08:00
parent d0872af38c
commit 8907160c3b
5 changed files with 79 additions and 18 deletions

View File

@@ -1,6 +1,6 @@
import { addToast } from "@heroui/react"
import { FolderFocusOne } from "@icon-park/react"
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
import { addToast } from "@heroui/react"
interface RoundedButtonProps {
children?: React.ReactNode
@@ -31,13 +31,55 @@ const CommonDir = () => {
</CardHeader>
<CardBody>
<div className="flex gap-1.5">
<RoundedButton onClick={()=> {alert("hello")}}>Steam安装位置</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>
<RoundedButton
onClick={() => {
alert("hello")
}}
>
Steam安装位置
</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>
</CardBody>
</Card>

View File

@@ -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 { useEffect, useState } from "react"
import { useSnapshot } from "valtio"
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
import { ToolButton } from "../window/ToolButton"
import { useEffect, useState } from "react"
const LaunchOption = () => {
void toolStore.start()
@@ -22,7 +27,7 @@ const LaunchOption = () => {
</CardIcon>
<CardTool>
{launchOptions.map((option, index) => (
<ToolButton key={index} onClick={() => setLaunchIndex(index)}>
<ToolButton key={option} onClick={() => setLaunchIndex(index)}>
{index + 1}
</ToolButton>
))}

View File

@@ -1,4 +1,5 @@
"use client"
import { setTheme as setTauriTheme } from "@/hooks/tauri/theme"
import { resetAppStore } from "@/store/app"
import { resetToolStore } from "@/store/tool"
import { addToast } from "@heroui/react"
@@ -11,15 +12,18 @@ import {
Square,
SunOne,
} 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 { useTheme } from "next-themes"
// import { platform } from "@tauri-apps/plugin-os"
import { usePathname, useRouter } from "next/navigation"
import { saveAllNow } from "tauri-plugin-valtio"
const Nav = () => {
const { theme, setTheme } = useTheme()
const setAppTheme = async (theme: Theme) => {
setTheme(theme)
await setTauriTheme(theme)
}
const close = async () => {
// (await window.hideOnClose) ? getCurrent().hide() : exit();
@@ -79,7 +83,7 @@ const Nav = () => {
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" ? setAppTheme("dark") : setAppTheme("light")
}
>
{theme === "light" ? <SunOne size={16} /> : <Moon size={16} />}

13
src/hooks/tauri/theme.ts Normal file
View 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,
})
}

View File

@@ -42,10 +42,7 @@ export const addLaunchOption = (option: string) => {
if (toolStore.state.launchOptions.length >= 10) {
return
}
toolStore.state.launchOptions = [
...toolStore.state.launchOptions,
option,
]
toolStore.state.launchOptions = [...toolStore.state.launchOptions, option]
}
export const resetToolStore = () => {