Files
cozsweet-frontend-nextjs/src/app/layout.tsx
T
admin dbc9a0cd13 refactor(auth): inline NextAuth v4 config and simplify AuthPlatform API
- Inline NextAuth v4 handler directly in `[...nextauth]/route.ts`, removing
  the `@/lib/auth/nextauth` abstraction layer
- Add Google/Facebook providers with JWT/session callbacks that expose
  `idToken` and `accessToken` on the session for backend exchange
- Refactor `AuthPlatform` from constructor-based to static methods
  (`googleSignIn()` / `facebookSignIn()`)
- Update `auth-machine.ts` and layout comment reference to match new structure
- Align with original Dart `nextauth-helpers.{googleLogin, facebookLogin}()`
  naming and keep persistence concerns (unstorage, backend, custom cookies)
  out of scope for this iteration
2026-06-12 17:20:56 +08:00

58 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Metadata, Viewport } from "next";
import { SessionProvider } from "@/providers/session-provider";
import { geistSans, geistMono, athelas } from "@/core/fonts";
import "./globals.css";
import { RootProviders } from "@/providers/root-providers";
export const metadata: Metadata = {
title: "cozsweet",
description: "cozsweet frontend (Next.js)",
// PWA:链接到 public/manifest.json(由 @ducanh2912/next-pwa 体系使用)
manifest: "/manifest.json",
// iOS Safari "添加到主屏" 元数据
appleWebApp: {
capable: true,
statusBarStyle: "default",
title: "cozsweet",
},
// iOS 触屏图标
icons: {
icon: "/favicon.ico",
apple: "/favicon.ico",
},
};
/**
* Next.js 14+ 推荐:viewport 相关元数据独立导出。
* 之前放在 `metadata.themeColor` 会在 Next.js 16 触发 deprecation 警告。
* 详见 https://nextjs.org/docs/app/api-reference/functions/generate-viewport
*/
export const viewport: Viewport = {
// 浏览器顶栏 / Android PWA 顶栏颜色
themeColor: "#f84d96",
};
export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
// suppressHydrationWarningnext/font + Tailwind v4 偶发类名差异;详见
// `src/app/api/auth/[...nextauth]/route.ts` 的"水合闪屏"说明。
<html
lang="en"
suppressHydrationWarning
className={`${geistSans.variable} ${geistMono.variable} ${athelas.variable} h-full antialiased`}
>
<body className="min-h-full flex flex-col">
{/* NextAuth SessionProvider:为所有客户端组件提供 useSession() 上下文 */}
<SessionProvider>
<RootProviders>{children}</RootProviders>
</SessionProvider>
</body>
</html>
);
}