'use client'; import { Locale } from '@/lib/i18n'; import { getSEOData, SEOData } from '@/lib/seo'; import { useEffect, useState } from 'react'; interface TDKManagerProps { locale: Locale; page: string; className?: string; } export default function TDKManager({ locale, page, className = '' }: TDKManagerProps) { const [seoData, setSeoData] = useState(null); const [loading, setLoading] = useState(true); useEffect(() => { const loadSEOData = async () => { try { setLoading(true); const data = await getSEOData(locale, page); setSeoData(data); } catch (error) { console.error('Failed to load SEO data:', error); } finally { setLoading(false); } }; loadSEOData(); }, [locale, page]); if (loading) { return (
); } if (!seoData) { return null; } return (

{locale === 'zh-CN' ? '页面标题' : locale === 'zh-TW' ? '頁面標題' : 'Page Title'}

{seoData.title}

{locale === 'zh-CN' ? '页面描述' : locale === 'zh-TW' ? '頁面描述' : 'Page Description'}

{seoData.description}

{locale === 'zh-CN' ? '关键词' : locale === 'zh-TW' ? '關鍵詞' : 'Keywords'}

{seoData.keywords.map((keyword, index) => ( {keyword} ))}
); }