86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
import type { Metadata } from "next";
|
||
import { Geist, Geist_Mono } from "next/font/google";
|
||
import localFont from "next/font/local";
|
||
import Script from "next/script";
|
||
import "./globals.css";
|
||
|
||
import { RootProviders } from "@/providers/root-providers";
|
||
|
||
const geistSans = Geist({
|
||
variable: "--font-geist-sans",
|
||
subsets: ["latin"],
|
||
});
|
||
|
||
const geistMono = Geist_Mono({
|
||
variable: "--font-geist-mono",
|
||
subsets: ["latin"],
|
||
});
|
||
|
||
/**
|
||
* Athelas 字体加载
|
||
* 原始资源:/Users/chase/Documents/cozsweet/fonts/Athelas-*.ttf
|
||
* 放置位置:/public/fonts/Athelas-*.ttf
|
||
*
|
||
* 路径计算(`next/font/local` 要求相对路径从调用文件出发):
|
||
* src/app/layout.tsx → ../../public/fonts/...
|
||
*
|
||
* 通过 `next/font/local` 自动 preload、压缩、inline。
|
||
* 输出 CSS 变量 `--font-athelas`,由 `globals.css` 桥接到 Tailwind `font-athelas`。
|
||
*/
|
||
const athelas = localFont({
|
||
src: [
|
||
{
|
||
path: "../../public/fonts/Athelas-Regular.ttf",
|
||
weight: "400",
|
||
style: "normal",
|
||
},
|
||
{
|
||
path: "../../public/fonts/Athelas-Bold.ttf",
|
||
weight: "700",
|
||
style: "normal",
|
||
},
|
||
{
|
||
path: "../../public/fonts/Athelas-BoldItalic.ttf",
|
||
weight: "700",
|
||
style: "italic",
|
||
},
|
||
],
|
||
variable: "--font-athelas",
|
||
display: "swap",
|
||
});
|
||
|
||
export const metadata: Metadata = {
|
||
title: "cozsweet",
|
||
description: "cozsweet frontend (Next.js)",
|
||
};
|
||
|
||
export default function RootLayout({
|
||
children,
|
||
}: Readonly<{
|
||
children: React.ReactNode;
|
||
}>) {
|
||
return (
|
||
// suppressHydrationWarning:next/font + Tailwind v4 偶发类名差异;详见
|
||
// `src/lib/auth/use-auth-gate.tsx` 的"水合闪屏"说明。
|
||
<html
|
||
lang="en"
|
||
suppressHydrationWarning
|
||
className={`${geistSans.variable} ${geistMono.variable} ${athelas.variable} h-full antialiased`}
|
||
>
|
||
<body className="min-h-full flex flex-col">
|
||
{/* Facebook SDK JS(auth + splash 入口会用到 FB.login) */}
|
||
<Script
|
||
src="https://connect.facebook.net/en_US/sdk.js"
|
||
strategy="afterInteractive"
|
||
/>
|
||
{/* Google Identity Services(auth 入口会用到 google.accounts.id) */}
|
||
<Script
|
||
src="https://accounts.google.com/gsi/client"
|
||
strategy="afterInteractive"
|
||
/>
|
||
<RootProviders>{children}</RootProviders>
|
||
</body>
|
||
</html>
|
||
);
|
||
}
|