[feat] add notice to launch and quit button + using Button

This commit is contained in:
Purp1e
2025-03-21 18:09:17 +08:00
parent e7a416dfec
commit 42a3efb217
2 changed files with 29 additions and 19 deletions

View File

@@ -3,7 +3,8 @@ import { useToolStore } from "@/store/tool"
import { TakeOff } from "@icon-park/react"
import { invoke } from "@tauri-apps/api/core"
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
// import { addToast } from "@heroui/react"
import { addToast, Button } from "@heroui/react"
import { title } from "process"
const FastLaunch = () => {
const steam = useSteamStore()
@@ -18,32 +19,34 @@ const FastLaunch = () => {
</CardHeader>
<CardBody>
<div className="flex gap-2">
<button
type="button"
onClick={() =>
<Button
size="sm"
onPress={async () => {
invoke("launch_game", {
steamPath: `${steam.state.steamDir}/steam.exe`,
launchOption: tool.state.launchOptions[tool.state.launchIndex] || "",
server: "perfectworld",
})
}
addToast({ title: "启动国服成功" })
}}
className="px-5 font-medium py-1.5 transition bg-red-200 dark:bg-red-900/60 rounded-full select-none"
>
</button>
<button
type="button"
onClick={() =>
</Button>
<Button
size="sm"
onPress={async () => {
invoke("launch_game", {
steamPath: `${steam.state.steamDir}/steam.exe`,
launchOption: tool.state.launchOptions[tool.state.launchIndex] || "",
server: "worldwide",
})
}
addToast({ title: "启动国际服成功" })
}}
className="px-5 font-medium py-1.5 transition bg-orange-200 dark:bg-orange-900/60 rounded-full select-none"
>
</button>
</Button>
</div>
</CardBody>
</Card>

View File

@@ -1,6 +1,7 @@
import { Power } from "@icon-park/react"
import { invoke } from "@tauri-apps/api/core"
import { Card, CardBody, CardHeader, CardIcon } from "../window/Card"
import { addToast, Button } from "@heroui/react"
const ForceQuit = () => {
return (
@@ -12,20 +13,26 @@ const ForceQuit = () => {
</CardHeader>
<CardBody>
<div className="flex gap-2">
<button
type="button"
onClick={() => invoke("kill_steam")}
<Button
size="sm"
onPress={async () => {
await invoke("kill_steam")
addToast({ title: "已关闭Steam" })
}}
className="px-5 font-medium py-1.5 transition bg-blue-200 dark:bg-blue-900/60 rounded-full select-none"
>
Steam
</button>
<button
type="button"
onClick={() => invoke("kill_game")}
</Button>
<Button
size="sm"
onPress={async () => {
await invoke("kill_game")
addToast({ title: "已关闭CS2" })
}}
className="px-5 font-medium py-1.5 transition bg-orange-200 dark:bg-orange-900/60 rounded-full select-none"
>
CS2
</button>
</Button>
</div>
</CardBody>
</Card>