feat: 剩余页面 useT() + 页脚 SystemConfig 动态渲染
- 学习分析/学习路径/设置/收藏/提示词工坊 页面 useT() - 页脚联系邮箱/ICP备案号从 GET /public/config 动态获取 - 翻译键补齐: discover.viewCount/likeCount/postStats
This commit is contained in:
@@ -1,8 +1,20 @@
|
||||
'use client';
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
import Link from 'next/link';
|
||||
import { useT } from '@/i18n';
|
||||
import { API_BASE } from '@/lib/config';
|
||||
|
||||
export function Footer() {
|
||||
const t = useT();
|
||||
const [config, setConfig] = useState<Record<string, string>>({});
|
||||
|
||||
useEffect(() => {
|
||||
fetch(`${API_BASE}/public/config`)
|
||||
.then(r => r.json()).then(data => setConfig(data || {}))
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<footer className="border-t border-border bg-muted/30">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 md:py-16">
|
||||
@@ -33,7 +45,7 @@ export function Footer() {
|
||||
<div>
|
||||
<h4 className="text-sm font-semibold mb-3">{t.footer.contact}</h4>
|
||||
<ul className="space-y-2.5">
|
||||
<li className="text-sm text-muted-foreground">邮箱:contact@yuzhiran.com</li>
|
||||
<li className="text-sm text-muted-foreground">{config.contact_email ? `邮箱:${config.contact_email}` : '邮箱:contact@yuzhiran.com'}</li>
|
||||
<li className="text-sm text-muted-foreground">北京宇之然科技中心</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -43,11 +55,7 @@ export function Footer() {
|
||||
<p>{t.footer.copyright.replace('{year}', String(new Date().getFullYear()))}</p>
|
||||
<p>
|
||||
<a href="https://beian.miit.gov.cn/" target="_blank" rel="noopener noreferrer" className="hover:text-foreground transition-colors">
|
||||
ICP 备案号:京ICP备XXXXXXXX号
|
||||
</a>
|
||||
<span className="mx-2">|</span>
|
||||
<a href="https://www.beian.gov.cn/" target="_blank" rel="noopener noreferrer" className="hover:text-foreground transition-colors">
|
||||
京公网安备 XXXXXXXXXXXX号
|
||||
{config.icp_number ? `ICP 备案号:${config.icp_number}` : 'ICP 备案号:京ICP备XXXXXXXX号'}
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user