update: store persist

This commit is contained in:
Purp1e
2024-09-26 16:58:40 +08:00
parent b3973fd101
commit 759cdbab98
17 changed files with 583 additions and 81 deletions

View File

@@ -7,8 +7,10 @@ import {
Card,
} from "@/components/window/Card";
import { ToolButton } from "../window/ToolButton";
import useAppStore from "@/store/app";
const Notice = () => {
const app = useAppStore();
return (
<Card>
<CardHeader>
@@ -22,9 +24,9 @@ const Notice = () => {
</ToolButton>
</CardTool>
</CardHeader>
<CardBody>CSGO工具箱吧 xswl</CardBody>
<CardBody>{app.notice || "不会真的有人要更新CSGO工具箱吧不会吧不会吧 xswl"}</CardBody>
</Card>
);
)
};
export default Notice;

View File

@@ -1,47 +1,43 @@
"use client"
import { ReactNode } from "react";
import clsx from "clsx";
import {
Home,
MonitorOne,
Movie,
Setting,
Terminal,
Toolkit,
} from "@icon-park/react";
import { useRouter } from "next/navigation";
import { ReactNode } from "react"
import clsx from "clsx"
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
import { useRouter } from "next/navigation"
import useAppStore from "@/store/app"
interface SideButtonProps {
className?: string;
children?: ReactNode;
className?: string
children?: ReactNode
}
const SideButton = ({ className, children, ...rest }: SideButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
const SideButton = ({
className,
children,
...rest
}: SideButtonProps & React.ButtonHTMLAttributes<HTMLButtonElement>) => {
return (
<button
className={clsx(
className,
"p-2.5 hover:bg-black/5 rounded-lg transition"
)}
{...rest}
>
<button className={clsx(className, "p-2.5 hover:bg-black/5 rounded-lg transition")} {...rest}>
{children}
</button>
);
};
)
}
const Avatar = () => {
const router = useRouter();
const router = useRouter()
return (
<div onClick={() => router.push('/users')} className="w-12 h-12 bg-gray-700 rounded-full cursor-pointer">
<div
onClick={() => router.push("/users")}
className="w-12 h-12 bg-gray-700 rounded-full cursor-pointer"
>
<img src="favicon.ico" alt="avatar" draggable={false} />
</div>
);
};
)
}
const SideBar = () => {
const router = useRouter();
const router = useRouter()
const { version, setVersion } = useAppStore()
return (
<div
@@ -76,15 +72,12 @@ const SideBar = () => {
</SideButton>
</section>
<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>0.0.1</p>
<p onClick={()=> setVersion("x.y.z")}>{version}</p>
</div>
</div>
);
};
)
}
export default SideBar;
export default SideBar