44 lines
1.2 KiB
TypeScript
44 lines
1.2 KiB
TypeScript
|
|
'use client';
|
||
|
|
|
||
|
|
import { useState, useEffect } from 'react';
|
||
|
|
import { useTranslation } from 'react-i18next';
|
||
|
|
import Header from '../Header';
|
||
|
|
import Footer from '../Footer';
|
||
|
|
import NewsArticlePageClient from './NewsArticlePageClient';
|
||
|
|
|
||
|
|
interface NewsArticlePageWrapperProps {
|
||
|
|
locale: string;
|
||
|
|
articleId: string;
|
||
|
|
initialData?: {
|
||
|
|
article: any;
|
||
|
|
relatedArticles: any[];
|
||
|
|
} | null;
|
||
|
|
}
|
||
|
|
|
||
|
|
export default function NewsArticlePageWrapper({ locale, articleId, initialData }: NewsArticlePageWrapperProps) {
|
||
|
|
const [language, setLanguage] = useState(locale);
|
||
|
|
const { t: tCommon } = useTranslation('common');
|
||
|
|
|
||
|
|
// 同步locale变化
|
||
|
|
useEffect(() => {
|
||
|
|
setLanguage(locale);
|
||
|
|
}, [locale]);
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="min-h-screen flex flex-col">
|
||
|
|
<Header
|
||
|
|
language={language}
|
||
|
|
setLanguage={setLanguage}
|
||
|
|
translations={tCommon}
|
||
|
|
locale={locale}
|
||
|
|
/>
|
||
|
|
<main className="flex-1">
|
||
|
|
<NewsArticlePageClient
|
||
|
|
locale={locale}
|
||
|
|
articleId={articleId}
|
||
|
|
/>
|
||
|
|
</main>
|
||
|
|
<Footer translations={tCommon} />
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|