[feat] dynamic version name

This commit is contained in:
Purp1e
2025-03-21 15:20:03 +08:00
parent 1f07d876d3
commit 90a05017ce
2 changed files with 14 additions and 26 deletions

View File

@@ -50,7 +50,7 @@ export function Prepare() {
setCheckCount((prev) => (prev >= 10 ? 10 : prev + 1))
console.log(checkCount, "触发", debounceValid, steam.state.steamDir, steam.state.cs2Dir)
if (checkCount < 1) {
if (checkCount < 2) {
if (debounceValid) {
console.log("跳转")
setTimeout(() => {

View File

@@ -1,15 +1,9 @@
"use client"
import { Button, cn } from "@heroui/react"
import {
Home,
MonitorOne,
Movie,
Setting,
Terminal,
Toolkit,
} from "@icon-park/react"
import { cn } from "@heroui/react"
import { Home, MonitorOne, Movie, Setting, Terminal, Toolkit } from "@icon-park/react"
import { usePathname, useRouter } from "next/navigation"
import type { ReactNode } from "react"
import { getVersion } from "@tauri-apps/api/app"
// import { platform } from "@tauri-apps/plugin-os"
import { useAppStore } from "@/store/app"
@@ -36,7 +30,7 @@ const SideButton = ({
className={cn(
className,
"p-2.5 hover:bg-black/5 rounded-lg transition relative",
path.startsWith(route) && "bg-black/5",
path.startsWith(route) && "bg-black/5"
)}
{...rest}
>
@@ -44,7 +38,7 @@ const SideButton = ({
<div
className={cn(
path.startsWith(route) && "opacity-100",
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2",
"transition-opacity duration-300 opacity-0 h-3.5 w-0.5 absolute left-0.5 bg-purple-500 rounded-full top-1/2 -translate-y-1/2"
)}
/>
</button>
@@ -60,7 +54,7 @@ const Avatar = () => {
onClick={() => router.push("/users")}
className={cn(
"w-12 h-12 bg-gray-700 rounded-full shadow-2xl cursor-pointer transition active:scale-95 shadow-purple-800",
path.startsWith("/users") && "shadow-sm",
path.startsWith("/users") && "shadow-sm"
)}
type="button"
>
@@ -72,10 +66,14 @@ const Avatar = () => {
const SideBar = () => {
const app = useAppStore()
getVersion().then((Value) => {
app.setVersion(Value)
})
return (
<div
className={cn(
"absolute left-0 flex flex-col h-full select-none w-20 pt-7 pb-5",
"absolute left-0 flex flex-col h-full select-none w-20 pt-7 pb-5"
// platform() === "windows" ? "w-20" : "w-[4.25rem]"
)}
data-tauri-drag-region
@@ -108,19 +106,9 @@ 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>
<Button
variant="light"
size="sm"
className="mt-0.5 text-zinc-600"
onPress={() => app.setVersion("x.y.z")}
>
{app.state.version}
</Button>
<p className="py-1 text-sm text-zinc-600">{app.state.version}</p>
</div>
</div>
)