From cbf41ec3f950cfc8edee30118c822d2ae9810c36 Mon Sep 17 00:00:00 2001 From: shenlan Date: Tue, 2 Dec 2025 08:53:11 +0800 Subject: [PATCH] Refactor footer component (#704) --- dashboard/src/app/page.tsx | 36 +---------- dashboard/src/components/Footer.tsx | 97 +++++++---------------------- 2 files changed, 25 insertions(+), 108 deletions(-) diff --git a/dashboard/src/app/page.tsx b/dashboard/src/app/page.tsx index 7ccf7f4..60974a6 100644 --- a/dashboard/src/app/page.tsx +++ b/dashboard/src/app/page.tsx @@ -7,8 +7,6 @@ import { ArrowRight, BookOpen, Command, - Github, - Globe, Layers, Link, Lock, @@ -20,6 +18,7 @@ import { Terminal, Users, } from 'lucide-react' +import Footer from '../components/Footer' const heroCards = [ { @@ -234,39 +233,6 @@ function ShortcutsSection() { ) } -function Footer() { - const socials = [ - { label: 'GitHub', icon: Github, href: 'https://github.com' }, - { label: 'Docs', icon: BookOpen, href: '#' }, - { label: 'Globe', icon: Globe, href: '#' }, - { label: 'API', icon: Link, href: '#' }, - ] - - return ( - - ) -} - function LogoPill({ label }: { label: string }) { return ( diff --git a/dashboard/src/components/Footer.tsx b/dashboard/src/components/Footer.tsx index 3069bf2..49973d6 100644 --- a/dashboard/src/components/Footer.tsx +++ b/dashboard/src/components/Footer.tsx @@ -1,82 +1,33 @@ -'use client' -import { usePathname } from 'next/navigation' - -import { BookOpen, Github, Globe, Link as LinkIcon, ShieldCheck } from 'lucide-react' -import { useLanguage } from '../i18n/LanguageProvider' -import { translations } from '../i18n/translations' - -const HIDDEN_PATH_PREFIXES = ['/login', '/register'] +import { BookOpen, Github, Globe, Link, ShieldCheck } from 'lucide-react' export default function Footer() { - const pathname = usePathname() - const isHidden = pathname ? HIDDEN_PATH_PREFIXES.some((prefix) => pathname.startsWith(prefix)) : false - if (isHidden) { - return null - } - - const { language } = useLanguage() - const t = translations[language].footerLinks - const [privacy, terms, contact] = t - - const socialLinks = [ - { label: 'GitHub', href: 'https://github.com/CloudNativeSuite', icon: Github }, - { label: language === 'zh' ? '文档' : 'Docs', href: '/docs', icon: BookOpen }, - { label: 'Website', href: 'https://cloudneutralsuite.example', icon: Globe }, - { label: 'API', href: '/api', icon: LinkIcon }, + const socials = [ + { label: 'GitHub', icon: Github, href: 'https://github.com' }, + { label: 'Docs', icon: BookOpen, href: '#' }, + { label: 'Globe', icon: Globe, href: '#' }, + { label: 'API', icon: Link, href: '#' }, ] return ( -