'use client';
import Navigation from '../../../../components/Navigation';
import Footer from '../../../../components/Footer';
import { useLanguage } from '../../../../hooks/useLanguage';
import Link from 'next/link';
import { LanguageType } from '../../../../lib/content';
interface ArticlePageProps {
params: {
lang: string;
id: string;
};
}
export default function ArticlePage({ params }: ArticlePageProps) {
const { currentLang, setCurrentLang, currentContent, createLocalizedPath } = useLanguage(
params.lang as LanguageType,
);
const articleId = parseInt(params.id, 10);
const article = currentContent.news.articles.find((a) => a.id === articleId);
const relatedArticles = currentContent.news.articles
.filter((a) => a.id !== articleId && a.category === article?.category)
.slice(0, 3);
if (!article) {
return (
文章未找到
抱歉,您访问的文章不存在。
返回资讯列表
{/* 🔧 完整调用 Footer,添加 createLocalizedPath */}
);
}
const getCategoryColor = (category: string) => {
const colors: Record = {
industry: 'bg-blue-500/20 text-blue-400 border-blue-500/30',
technology: 'bg-green-500/20 text-green-400 border-green-500/30',
company: 'bg-purple-500/20 text-purple-400 border-purple-500/30',
case: 'bg-orange-500/20 text-orange-400 border-orange-500/30',
};
return colors[category] ?? 'bg-gray-500/20 text-gray-400 border-gray-500/30';
};
return (
{/* Breadcrumb */}
{/* Article Header */}
{currentContent.news.categories[article.category]}
{article.title}
{/* Tags */}
{article.tags.map((tag, idx) => (
#{tag}
))}
{/* Article Content */}
{article.summary}
{article.content.split('\n').map((paragraph, idx) => (
{paragraph}
))}
{/* Share Section */}
{/* Related Articles */}
{relatedArticles.length > 0 && (
)}
{/* 🔧 完整调用 Footer,传入 createLocalizedPath */}
);
}