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 (
    <Card className="max-w-fit">
      <CardHeader>
        <CardIcon>
          <Power /> 强制退出
        </CardIcon>
      </CardHeader>
      <CardBody>
        <div className="flex gap-2">
          <Button
            size="md"
            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
            size="md"
            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>
        </div>
      </CardBody>
    </Card>
  )
}

export default ForceQuit
