Files
cstb-next/src/app/prepare/page.tsx

57 lines
2.0 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client"
import { useSteamStore } from "@/store/steam"
import { useEffect, useState } from "react"
export default function Page() {
const steam = useSteamStore()
const [steamDir, setSteamDir] = useState(steam.state.steamDir)
const [cs2Dir, setCs2Dir] = useState(steam.state.cs2Dir)
useEffect(() => {
setSteamDir(steam.state.steamDir)
setCs2Dir(steam.state.cs2Dir)
}, [steam.state.steamDir, steam.state.cs2Dir])
return (
<div
className="flex flex-col items-center justify-center w-full h-screen gap-6"
data-tauri-drag-region
>
<h1 className="text-4xl font-bold tracking-wide">CS </h1>
<p className="text-sm text-zinc-500"></p>
<div className="flex flex-col w-full max-w-2xl gap-4 p-5 border rounded-lg bg-white/40 dark:bg-zinc-800/40">
<div className="space-y-2">
<p className="text-sm font-semibold">Steam </p>
<input
className="w-full px-3 py-2 rounded-lg bg-white dark:bg-zinc-700 border border-zinc-300 dark:border-zinc-600"
placeholder="请输入 Steam 安装路径"
value={steamDir}
onChange={(e) => {
setSteamDir(e.target.value)
steam.setDir(e.target.value)
}}
/>
</div>
<div className="space-y-2">
<p className="text-sm font-semibold">CS2 </p>
<input
className="w-full px-3 py-2 rounded-lg bg-white dark:bg-zinc-700 border border-zinc-300 dark:border-zinc-600"
placeholder="请输入 CS2 安装路径"
value={cs2Dir}
onChange={(e) => {
setCs2Dir(e.target.value)
steam.setCsDir(e.target.value)
}}
/>
</div>
{steam.currentUser()?.steam_id64 && (
<p className="text-xs text-zinc-500">
64 Steam ID{steam.currentUser()?.steam_id64}
</p>
)}
</div>
</div>
)
}