Acrylic cards and topbar over a blurred background, country flags, ISP and OS icons, per-node version tags, a build info footer and an admin versions tab. Overview cards drop the sparkline and widen the hover area.
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import { api } from '@shared/api/client'
|
|
import type { AboutDto, BuildDto } from '@shared/api/types'
|
|
import { fmtBuiltAt, frontendBuild } from '@shared/buildInfo'
|
|
import { useQuery } from '@shared/hooks'
|
|
|
|
/** 「0.1.1 · v0.1.1-5-gabc123 · 2026-10-06 20:30」:版本、tag(和版本一样就不重复写)、构建时间。 */
|
|
function buildText(b: { version: string; tag?: string | null; built_at?: string | null }): string {
|
|
const parts = [b.version]
|
|
if (b.tag && b.tag.replace(/^v/, '') !== b.version) parts.push(b.tag)
|
|
const at = fmtBuiltAt(b.built_at)
|
|
if (at) parts.push(at)
|
|
return parts.join(' · ')
|
|
}
|
|
|
|
/**
|
|
* 页面底部的构建信息:后端和前端的版本、tag、构建时间。要管理员在设置里打开「site.show_build」才显示;
|
|
* 关着的时候(或者后端太旧没有这个接口)什么也不画,前端自己的信息也不单独露出来。
|
|
*/
|
|
export function BuildFooter() {
|
|
const about = useQuery(() => api.get<AboutDto>('/api/public/about'), [], 5 * 60_000)
|
|
if (!about.data?.show_build || !about.data.backend) return null
|
|
const backend: BuildDto = about.data.backend
|
|
return (
|
|
<div className="build-info">
|
|
<span>后端 {buildText(backend)}</span>
|
|
<span>前端 {buildText({ version: frontendBuild.version, tag: frontendBuild.tag, built_at: frontendBuild.builtAt })}</span>
|
|
</div>
|
|
)
|
|
}
|