[feat] home page notification and styles

This commit is contained in:
Purp1e
2025-03-22 17:50:35 +08:00
parent 6209db2d45
commit 08a6bfe9de
5 changed files with 57 additions and 19 deletions

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,8 +2,33 @@ import { BatteryCharge, Refresh } from "@icon-park/react"
import { invoke } from "@tauri-apps/api/core"
import { Card, CardBody, CardHeader, CardIcon, CardTool } from "../window/Card"
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 handleSelectionChange = (key: Key) => {
console.log(key)
}
return (
<Card>
<CardHeader>
@@ -18,7 +43,7 @@ const PowerPlan = () => {
</CardTool>
</CardHeader>
<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
type="button"
onClick={() => invoke("set_power_plan", { index: 1 })}
@@ -40,7 +65,12 @@ const PowerPlan = () => {
>
节能
</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>
</Card>
)