welcome窗口显示动态版本号
This commit is contained in:
@@ -1,10 +1,21 @@
|
|||||||
"use client"
|
"use client"
|
||||||
|
|
||||||
|
import { useEffect, useState } from "react"
|
||||||
import { MessageCircleCode } from "lucide-react"
|
import { MessageCircleCode } from "lucide-react"
|
||||||
import { useTranslations } from "next-intl"
|
import { useTranslations } from "next-intl"
|
||||||
|
import { getCurrentAppVersion } from "@/lib/updater"
|
||||||
|
|
||||||
export function SoftwareInfo() {
|
export function SoftwareInfo() {
|
||||||
const t = useTranslations("WelcomePage")
|
const t = useTranslations("WelcomePage")
|
||||||
|
const [version, setVersion] = useState<string>("")
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
getCurrentAppVersion()
|
||||||
|
.then(setVersion)
|
||||||
|
.catch((err) => {
|
||||||
|
console.error("[Welcome] get app version failed:", err)
|
||||||
|
})
|
||||||
|
}, [])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full flex gap-4 px-6 py-8">
|
<div className="w-full flex gap-4 px-6 py-8">
|
||||||
@@ -12,7 +23,9 @@ export function SoftwareInfo() {
|
|||||||
<div className="flex flex-col">
|
<div className="flex flex-col">
|
||||||
<span className="text-base">Codeg</span>
|
<span className="text-base">Codeg</span>
|
||||||
<span className="text-sm text-muted-foreground">
|
<span className="text-sm text-muted-foreground">
|
||||||
{t("softwareVersion", { version: "0.0.1" })}
|
{version
|
||||||
|
? t("softwareVersion", { version })
|
||||||
|
: t("softwareVersion", { version: "..." })}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user