[feat] adapt steam store + adjust dark mode styles
This commit is contained in:
@@ -1,12 +1,18 @@
|
|||||||
"use client"
|
"use client"
|
||||||
import { appStore } from "@/store/app"
|
import { appStore } from "@/store/app"
|
||||||
|
import { useEffect } from "react"
|
||||||
import { useSnapshot } from "valtio"
|
import { useSnapshot } from "valtio"
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
|
useEffect(() => {
|
||||||
|
;async () => {
|
||||||
|
appStore.start()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
const app = useSnapshot(appStore.state)
|
const app = useSnapshot(appStore.state)
|
||||||
|
|
||||||
return (
|
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.version}</p>
|
||||||
<p>是否有更新:{app.hasUpdate ? "有" : "无"}</p>
|
<p>是否有更新:{app.hasUpdate ? "有" : "无"}</p>
|
||||||
<p>初始化:{app.inited ? "是" : "否"}</p>
|
<p>初始化:{app.inited ? "是" : "否"}</p>
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
"use client"
|
"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() {
|
export default function Page() {
|
||||||
const steam = SteamStore()
|
useEffect(() => {
|
||||||
|
;async () => {
|
||||||
|
steamStore.start()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
const steam = useSnapshot(steamStore.state)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col items-start gap-3 pt-2 pb-1">
|
<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.csDir}</p>
|
||||||
<p>Steam路径有效:{steam.isDirValid ? "是" : "否"}</p>
|
<p>Steam路径有效:{steam.isDirValid ? "是" : "否"}</p>
|
||||||
<p>游戏路径有效:{steam.isCsDirValid ? "是" : "否"}</p>
|
<p>游戏路径有效:{steam.isCsDirValid ? "是" : "否"}</p>
|
||||||
<p>Steam账号:{steam.currentUser().accountName}</p>
|
<p>Steam账号:{currentUser().accountName}</p>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,15 @@
|
|||||||
"use client"
|
"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() {
|
export default function Page() {
|
||||||
const { dir, setDir, csDir, setCsDir, currentUser } = useSteamStore()
|
useEffect(() => {
|
||||||
|
;async () => {
|
||||||
|
steamStore.start()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
const steam = useSnapshot(steamStore.state)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="flex flex-col items-center justify-center w-full h-screen gap-6"
|
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">
|
<div className="flex flex-col w-full gap-6 p-5 border rounded-lg bg-white/40">
|
||||||
<input
|
<input
|
||||||
className="px-2 py-1 rounded-lg"
|
className="px-2 py-1 rounded-lg"
|
||||||
value={dir}
|
value={steam.dir}
|
||||||
onChange={(e) => setDir(e.target.value)}
|
onChange={(e) => setDir(e.target.value)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
className="px-2 py-1 rounded-lg"
|
className="px-2 py-1 rounded-lg"
|
||||||
value={csDir}
|
value={steam.csDir}
|
||||||
onChange={(e) => setCsDir(e.target.value)}
|
onChange={(e) => setCsDir(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { ThemeProvider as NextThemesProvider } from "next-themes"
|
|||||||
export default function Providers({ children }: { children: React.ReactNode }) {
|
export default function Providers({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<HeroUIProvider className="h-full bg-transparent">
|
<HeroUIProvider className="h-full bg-transparent">
|
||||||
<NextThemesProvider attribute="class" defaultTheme="light">
|
<NextThemesProvider attribute="class" defaultTheme="light" >
|
||||||
<ToastProvider toastOffset={10} placement="top-center" />
|
<ToastProvider toastOffset={10} placement="top-center" />
|
||||||
{children}
|
{children}
|
||||||
</NextThemesProvider>
|
</NextThemesProvider>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const RoundedButton = ({ children }: RoundedButtonProps) => {
|
|||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className="flex items-center justify-center px-3 py-1 transition rounded-full min-w-fit active:scale-95 hover:bg-black/10 text-zinc-700 bg-black/5"
|
className="flex items-center justify-center px-3 py-1 transition rounded-full min-w-fit active:scale-95 hover:bg-black/10 text-zinc-700 dark:text-zinc-100 bg-black/5"
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -3,8 +3,14 @@ import { appStore } from "@/store/app"
|
|||||||
import { Refresh, VolumeNotice } from "@icon-park/react"
|
import { Refresh, VolumeNotice } from "@icon-park/react"
|
||||||
import { ToolButton } from "../window/ToolButton"
|
import { ToolButton } from "../window/ToolButton"
|
||||||
import { useSnapshot } from "valtio"
|
import { useSnapshot } from "valtio"
|
||||||
|
import { useEffect } from "react"
|
||||||
|
|
||||||
const Notice = () => {
|
const Notice = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
;async () => {
|
||||||
|
appStore.start()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
appStore.start()
|
appStore.start()
|
||||||
const app = useSnapshot(appStore.state)
|
const app = useSnapshot(appStore.state)
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ const CardTool = ({ children }: CardProps) => {
|
|||||||
|
|
||||||
const CardBody = ({ children }: CardProps) => {
|
const CardBody = ({ children }: CardProps) => {
|
||||||
return (
|
return (
|
||||||
<div className="w-full h-full text-sm tracking-wide text-zinc-800">
|
<div className="w-full h-full text-sm tracking-wide text-zinc-800 dark:text-white">
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ const Nav = () => {
|
|||||||
resetToolStore()
|
resetToolStore()
|
||||||
addToast({
|
addToast({
|
||||||
title: "重置成功",
|
title: "重置成功",
|
||||||
description: "已重置所有设置,请重新启动程序",
|
color: 'success'
|
||||||
|
// description: "已重置所有设置",
|
||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
|
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
|
||||||
import { Button, cn } from "@heroui/react"
|
import { Button, cn } from "@heroui/react"
|
||||||
import { usePathname, useRouter } from "next/navigation"
|
import { usePathname, useRouter } from "next/navigation"
|
||||||
import type { ReactNode } from "react"
|
import { useEffect, type ReactNode } from "react"
|
||||||
|
|
||||||
// import { platform } from "@tauri-apps/plugin-os"
|
// import { platform } from "@tauri-apps/plugin-os"
|
||||||
import { appStore, setVersion } from "@/store/app"
|
import { appStore, setVersion } from "@/store/app"
|
||||||
@@ -63,7 +63,11 @@ const Avatar = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SideBar = () => {
|
const SideBar = () => {
|
||||||
|
useEffect(() => {
|
||||||
|
;async () => {
|
||||||
appStore.start()
|
appStore.start()
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
const { version } = useSnapshot(appStore.state)
|
const { version } = useSnapshot(appStore.state)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -104,7 +108,12 @@ const SideBar = () => {
|
|||||||
|
|
||||||
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
|
<div className="mx-auto text-sm text-center text-zinc-500" data-tauri-drag-region>
|
||||||
<p>版本号</p>
|
<p>版本号</p>
|
||||||
<Button variant="light" size="sm" className="mt-0.5 text-zinc-600" onPress={() => setVersion("x.y.z")}>
|
<Button
|
||||||
|
variant="light"
|
||||||
|
size="sm"
|
||||||
|
className="mt-0.5 text-zinc-600"
|
||||||
|
onPress={() => setVersion("x.y.z")}
|
||||||
|
>
|
||||||
{version}
|
{version}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user