Files
fad-trade-next/app/[locale]/layout.tsx
砂糖 b53f104d9b refactor: 更新品牌信息为巨丰钢铁并优化相关配置
更新公司品牌信息从"福安德外贸"到"巨丰钢铁",包括:
1. 修改所有相关文档中的公司名称和描述
2. 更新网站配置和邮件模板
3. 移除不必要的分析工具和社交媒体链接
4. 优化i18n多语言配置
5. 调整next.config.mjs输出模式为standalone
6. 更新favicon和logo图片
7. 清理未使用的代码和文件
2026-01-26 15:40:31 +08:00

95 lines
2.5 KiB
TypeScript

import Footer from "@/components/footer/Footer";
import Header from "@/components/header/Header";
import { LanguageDetectionAlert } from "@/components/LanguageDetectionAlert";
import { TailwindIndicator } from "@/components/TailwindIndicator";
import { siteConfig } from "@/config/site";
import { DEFAULT_LOCALE, Locale, routing } from "@/i18n/routing";
import { constructMetadata } from "@/lib/metadata";
import { cn } from "@/lib/utils";
import "@/styles/globals.css";
import "@/styles/loading.css";
import { Metadata, Viewport } from "next";
import { hasLocale, NextIntlClientProvider } from "next-intl";
import {
getMessages,
getTranslations,
setRequestLocale,
} from "next-intl/server";
import { ThemeProvider } from "next-themes";
import { notFound } from "next/navigation";
// import './globals.css';
type MetadataProps = {
params: Promise<{ locale: string }>;
};
export async function generateMetadata({
params,
}: MetadataProps): Promise<Metadata> {
const { locale } = await params;
const t = await getTranslations({ locale, namespace: "Home" });
return constructMetadata({
page: "Home",
title: t("title"),
description: t("description"),
locale: locale as Locale,
path: `/`,
canonicalUrl: `/`,
});
}
export const viewport: Viewport = {
themeColor: siteConfig.themeColors,
};
export default async function LocaleLayout({
children,
params,
}: {
children: React.ReactNode;
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
// Ensure that the incoming `locale` is valid
if (!hasLocale(routing.locales, locale)) {
notFound();
}
setRequestLocale(locale);
// Providing all messages to the client
// side is the easiest way to get started
const messages = await getMessages();
return (
<html lang={locale || DEFAULT_LOCALE} suppressHydrationWarning>
<head />
<body
className={cn(
"min-h-screen bg-background flex flex-col font-sans antialiased"
)}
>
<NextIntlClientProvider messages={messages}>
<ThemeProvider
attribute="class"
defaultTheme={siteConfig.defaultNextTheme}
enableSystem
>
{messages.LanguageDetection && <LanguageDetectionAlert />}
{messages.Header && <Header />}
<main className="flex-1 flex flex-col items-center">
{children}
</main>
{messages.Footer && <Footer />}
</ThemeProvider>
</NextIntlClientProvider>
<TailwindIndicator />
</body>
</html>
);
}