[feat] adapt steam store + adjust dark mode styles

This commit is contained in:
Purp1e
2025-03-12 13:16:25 +08:00
parent 0c102dfd63
commit 91a003d016
9 changed files with 51 additions and 15 deletions

View File

@@ -1,12 +1,18 @@
"use client"
import { appStore } from "@/store/app"
import { useEffect } from "react"
import { useSnapshot } from "valtio"
export default function Page() {
useEffect(() => {
;async () => {
appStore.start()
}
}, [])
const app = useSnapshot(appStore.state)
return (
<div className="flex flex-col gap-3 items-start pt-2 pb-1">
<div className="flex flex-col items-start gap-3 pt-2 pb-1">
<p>{app.version}</p>
<p>{app.hasUpdate ? "有" : "无"}</p>
<p>{app.inited ? "是" : "否"}</p>

View File

@@ -1,8 +1,15 @@
"use client"
import SteamStore from "@/store/steam"
import { currentUser, steamStore } from "@/store/steam"
import { useEffect } from "react"
import { useSnapshot } from "valtio"
export default function Page() {
const steam = SteamStore()
useEffect(() => {
;async () => {
steamStore.start()
}
}, [])
const steam = useSnapshot(steamStore.state)
return (
<div className="flex flex-col items-start gap-3 pt-2 pb-1">
@@ -10,7 +17,7 @@ export default function Page() {
<p>{steam.csDir}</p>
<p>Steam路径有效{steam.isDirValid ? "是" : "否"}</p>
<p>{steam.isCsDirValid ? "是" : "否"}</p>
<p>Steam账号{steam.currentUser().accountName}</p>
<p>Steam账号{currentUser().accountName}</p>
</div>
)
}

View File

@@ -1,8 +1,15 @@
"use client"
import useSteamStore from "@/store/steam"
import { steamStore, setDir, setCsDir, currentUser } from "@/store/steam"
import { useEffect } from "react"
import { useSnapshot } from "valtio"
export default function Page() {
const { dir, setDir, csDir, setCsDir, currentUser } = useSteamStore()
useEffect(() => {
;async () => {
steamStore.start()
}
}, [])
const steam = useSnapshot(steamStore.state)
return (
<div
className="flex flex-col items-center justify-center w-full h-screen gap-6"
@@ -16,12 +23,12 @@ export default function Page() {
<div className="flex flex-col w-full gap-6 p-5 border rounded-lg bg-white/40">
<input
className="px-2 py-1 rounded-lg"
value={dir}
value={steam.dir}
onChange={(e) => setDir(e.target.value)}
/>
<input
className="px-2 py-1 rounded-lg"
value={csDir}
value={steam.csDir}
onChange={(e) => setCsDir(e.target.value)}
/>

View File

@@ -6,7 +6,7 @@ import { ThemeProvider as NextThemesProvider } from "next-themes"
export default function Providers({ children }: { children: React.ReactNode }) {
return (
<HeroUIProvider className="h-full bg-transparent">
<NextThemesProvider attribute="class" defaultTheme="light">
<NextThemesProvider attribute="class" defaultTheme="light" >
<ToastProvider toastOffset={10} placement="top-center" />
{children}
</NextThemesProvider>