Files
jiang13-bbs/frontend/components/Footer.tsx

31 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import pkg from "../package.json";
import FooterTiming from "./FooterTiming";
// 官方镜像构建会写入 NEXT_PUBLIC_APP_VERSION(可与脚手架 0.1.0 相同)。
// 未注入时,脚手架默认号仍当未发布,页脚显示占位。
function realVersion(pkgVersion: string): string {
const injected = process.env.NEXT_PUBLIC_APP_VERSION?.trim();
if (injected) return injected;
return !pkgVersion || pkgVersion === "0.0.0" || pkgVersion === "0.1.0" ? "" : pkgVersion;
}
// 极简页脚:版权 + 实时性能指标(版本 / 页面加载 / 模板生成)
export default function Footer({ siteName = "姜十三社区" }: { siteName?: string }) {
const year = new Date().getFullYear();
const brand = siteName.trim() || "姜十三社区";
return (
<footer
style={{
borderTop: "1px solid var(--line)",
background: "var(--panel)",
}}
>
<div className="max-w-[1440px] mx-auto px-4 sm:px-6 py-4 flex items-center justify-between gap-4">
<span className="meta text-[12px] whitespace-nowrap">© {year} {brand}</span>
<FooterTiming version={realVersion(pkg.version)} />
</div>
</footer>
);
}