dev-prepare #2

Merged
purp1e merged 42 commits from dev-prepare into master 2025-03-24 02:16:40 +08:00
5 changed files with 57 additions and 19 deletions
Showing only changes of commit 08a6bfe9de - Show all commits

View File

@@ -63,9 +63,7 @@ pub fn set_powerplan(plan: &str) -> Result<String, String> {
Ok(format!("Set powerplan to {}", plan)) Ok(format!("Set powerplan to {}", plan))
} }
// TODO get_cs_path
// TODO get_powerplan
// TODO set_powerplan
// TODO watch_steam_users // TODO watch_steam_users
// TODO watch_video_settings // TODO watch_video_settings
// TODO watch + cancel // TODO watch + cancel

View File

@@ -42,10 +42,10 @@ const CommonDir = () => {
await invoke("open_path", { await invoke("open_path", {
path: steam.state.steamDir, path: steam.state.steamDir,
}) })
addToast({ title: "Steam安装位置" }) addToast({ title: "Steam安装目录" })
}} }}
> >
Steam安装位置 Steam安装目录
</RoundedButton> </RoundedButton>
<RoundedButton <RoundedButton
onClick={async () => { onClick={async () => {
@@ -62,20 +62,20 @@ const CommonDir = () => {
await invoke("open_path", { await invoke("open_path", {
path: path.resolve(steam.cs2BaseDir(), "game", "csgo", "maps"), path: path.resolve(steam.cs2BaseDir(), "game", "csgo", "maps"),
}) })
addToast({ title: "地图文件" }) addToast({ title: "地图目录" })
}} }}
> >
</RoundedButton> </RoundedButton>
<RoundedButton <RoundedButton
onClick={async () => { onClick={async () => {
await invoke("open_path", { await invoke("open_path", {
path: path.resolve(steam.cs2BaseDir(), "game", "csgo", "cfg"), path: path.resolve(steam.cs2BaseDir(), "game", "csgo", "cfg"),
}) })
addToast({ title: "游戏CFG目录" }) addToast({ title: "游戏CFG" })
}} }}
> >
CFG目录 CFG
</RoundedButton> </RoundedButton>
<RoundedButton <RoundedButton
onClick={async () => { onClick={async () => {
@@ -83,10 +83,20 @@ const CommonDir = () => {
// TODO 导航到 steamid32/730/local/cfg // TODO 导航到 steamid32/730/local/cfg
path: path.resolve(steam.state.steamDir, "userdata"), path: path.resolve(steam.state.steamDir, "userdata"),
}) })
addToast({ title: "个人CFG目录" }) addToast({ title: "个人CFG" })
}} }}
> >
CFG目录 CFG
</RoundedButton>
<RoundedButton
onClick={async () => {
await invoke("open_path", {
path: path.resolve(steam.cs2BaseDir(), "game", "csgo", "replays"),
})
addToast({ title: "官匹录像" })
}}
>
</RoundedButton> </RoundedButton>
<RoundedButton <RoundedButton
onClick={async () => { onClick={async () => {

View File

@@ -10,7 +10,7 @@ const FastLaunch = () => {
const tool = useToolStore() const tool = useToolStore()
return ( return (
<Card> <Card className="max-w-fit">
<CardHeader> <CardHeader>
<CardIcon> <CardIcon>
<TakeOff /> <TakeOff />
@@ -19,7 +19,7 @@ const FastLaunch = () => {
<CardBody> <CardBody>
<div className="flex gap-2"> <div className="flex gap-2">
<Button <Button
size="sm" size="md"
onPress={() => { onPress={() => {
void invoke("launch_game", { void invoke("launch_game", {
steamPath: `${steam.state.steamDir}/steam.exe`, steamPath: `${steam.state.steamDir}/steam.exe`,
@@ -33,7 +33,7 @@ const FastLaunch = () => {
</Button> </Button>
<Button <Button
size="sm" size="md"
onPress={() => { onPress={() => {
void invoke("launch_game", { void invoke("launch_game", {
steamPath: `${steam.state.steamDir}/steam.exe`, steamPath: `${steam.state.steamDir}/steam.exe`,

View File

@@ -5,7 +5,7 @@ import { addToast, Button } from "@heroui/react"
const ForceQuit = () => { const ForceQuit = () => {
return ( return (
<Card> <Card className="max-w-fit">
<CardHeader> <CardHeader>
<CardIcon> <CardIcon>
<Power /> 退 <Power /> 退
@@ -14,7 +14,7 @@ const ForceQuit = () => {
<CardBody> <CardBody>
<div className="flex gap-2"> <div className="flex gap-2">
<Button <Button
size="sm" size="md"
onPress={async () => { onPress={async () => {
await invoke("kill_steam") await invoke("kill_steam")
addToast({ title: "已关闭Steam" }) addToast({ title: "已关闭Steam" })
@@ -24,7 +24,7 @@ const ForceQuit = () => {
Steam Steam
</Button> </Button>
<Button <Button
size="sm" size="md"
onPress={async () => { onPress={async () => {
await invoke("kill_game") await invoke("kill_game")
addToast({ title: "已关闭CS2" }) addToast({ title: "已关闭CS2" })

View File

@@ -2,8 +2,33 @@ import { BatteryCharge, Refresh } from "@icon-park/react"
import { invoke } from "@tauri-apps/api/core" import { invoke } from "@tauri-apps/api/core"
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 { Tabs, Tab } from "@heroui/react"
import { Key } from "@react-types/shared"
const PowerPlans = [
{
id: "1",
title: "节能",
},
{
id: "2",
title: "平衡",
},
{
id: "3",
title: "高性能",
},
{
id: "4",
title: "卓越性能",
},
]
const PowerPlan = () => { const PowerPlan = () => {
const handleSelectionChange = (key: Key) => {
console.log(key)
}
return ( return (
<Card> <Card>
<CardHeader> <CardHeader>
@@ -18,7 +43,7 @@ const PowerPlan = () => {
</CardTool> </CardTool>
</CardHeader> </CardHeader>
<CardBody> <CardBody>
<div className="flex p-0.5 bg-black/5 gap-2 rounded-full"> {/* <div className="flex p-0.5 bg-black/5 gap-2 rounded-full">
<button <button
type="button" type="button"
onClick={() => invoke("set_power_plan", { index: 1 })} onClick={() => invoke("set_power_plan", { index: 1 })}
@@ -40,7 +65,12 @@ const PowerPlan = () => {
> >
节能 节能
</button> </button>
</div> </div> */}
<Tabs aria-label="Power Plan Tabs" size="md" radius="full" fullWidth defaultSelectedKey="0" onSelectionChange={handleSelectionChange}>
{PowerPlans.map((item) => (
<Tab key={item.id} title={item.title}></Tab>
))}
</Tabs>
</CardBody> </CardBody>
</Card> </Card>
) )