welcome窗口显示动态版本号

This commit is contained in:
xintaofei
2026-03-13 22:08:38 +08:00
parent 3376974d0f
commit 20df61d63a

View File

@@ -1,10 +1,21 @@
"use client"
import { useEffect, useState } from "react"
import { MessageCircleCode } from "lucide-react"
import { useTranslations } from "next-intl"
import { getCurrentAppVersion } from "@/lib/updater"
export function SoftwareInfo() {
const t = useTranslations("WelcomePage")
const [version, setVersion] = useState<string>("")
useEffect(() => {
getCurrentAppVersion()
.then(setVersion)
.catch((err) => {
console.error("[Welcome] get app version failed:", err)
})
}, [])
return (
<div className="w-full flex gap-4 px-6 py-8">
@@ -12,7 +23,9 @@ export function SoftwareInfo() {
<div className="flex flex-col">
<span className="text-base">Codeg</span>
<span className="text-sm text-muted-foreground">
{t("softwareVersion", { version: "0.0.1" })}
{version
? t("softwareVersion", { version })
: t("softwareVersion", { version: "..." })}
</span>
</div>
</div>