Files
Momento/memento-note/app/layout.tsx
Antigravity 1f5dc6af09
All checks were successful
CI / Lint, Unit Tests & Build (push) Successful in 5m24s
CI / Deploy production (on server) (push) Successful in 24s
fix(tsc): 0 erreur TypeScript — toutes les 31 erreurs résolues
Types:
- NoteType: 'daily' ajouté
- PROPERTY_TYPES: 'relation' ajouté
- SlashItem: isFavorite? ajouté
- SuggestChartsResponse: error? ajouté

Fixes propres:
- import/route: Date | null → ?? undefined (3 occ)
- notes/route: JSON.stringify sur checkItems/labels
- user/export: b.title → b.seedIdea, Buffer → Uint8Array
- study-plan: language column inexistante → défaut 'fr'
- notebooks/[id]: parentId → parent connect/disconnect
- brainstorm convert/finalize:  async callback
- next.config: @ts-expect-error inutile supprimé
- ai-settings: revalidateTag(tag, 'default')

Casts (TipTap/Prisma, safe at runtime):
- tiptap-chart/math extensions: InputRule/options as any
- chat/route: system messages as any
- note-graph-view: ForceGraph2D as any
- property-value-editor: relation comparison
- sanitize-content: TrustedHTML cast
2026-07-05 17:35:37 +00:00

118 lines
3.9 KiB
TypeScript

import type { Metadata, Viewport } from "next";
import "./globals.css";
import { Toaster } from "@/components/ui/toast";
import { SessionProviderWrapper } from "@/components/session-provider-wrapper";
import { getAISettings } from "@/app/actions/ai-settings";
import { getUserSettings } from "@/app/actions/user-settings";
import { ThemeInitializer } from "@/components/theme-initializer";
import { DirectionInitializer } from "@/components/direction-initializer";
import { ErrorReporter } from "@/components/error-reporter";
import { auth } from "@/auth";
import { CookieConsentRoot } from "@/components/legal/cookie-consent-root";
import { LanguageProvider } from "@/lib/i18n/LanguageProvider";
import Script from "next/script";
import type { CSSProperties } from "react";
import { normalizeThemeId } from "@/lib/apply-document-theme";
import { Inter, Manrope, Playfair_Display, JetBrains_Mono } from "next/font/google";
const inter = Inter({
subsets: ["latin"],
variable: "--font-inter",
});
const manrope = Manrope({
subsets: ["latin"],
variable: "--font-manrope",
});
const playfair = Playfair_Display({
subsets: ["latin"],
variable: "--font-memento-serif",
weight: ["400", "500", "600", "700"],
});
const jetbrainsMono = JetBrains_Mono({
subsets: ["latin"],
variable: "--font-jetbrains-mono",
weight: ["400", "500"],
});
export const metadata: Metadata = {
title: "Memento - Your Digital Notepad",
description: "A beautiful note-taking app built with Next.js 16",
manifest: "/api/manifest",
icons: {
icon: "/icons/icon-512.svg",
apple: "/icons/icon-512.svg",
},
appleWebApp: {
capable: true,
statusBarStyle: "default",
title: "Memento",
},
};
export const viewport: Viewport = {
themeColor: "#1C1C1C",
};
function serverHtmlThemeState(theme?: string | null): { className?: string; dataTheme?: string } {
const t = normalizeThemeId(theme || 'light')
if (t === 'auto') return {}
if (t === 'dark') return { className: 'dark' }
if (t === 'light') return {}
if (t === 'midnight') return { className: 'dark', dataTheme: 'midnight' }
const named = ['sepia', 'rose', 'green', 'lavender', 'sand', 'ocean', 'sunset', 'blue'] as const
if ((named as readonly string[]).includes(t)) return { dataTheme: t }
return {}
}
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const session = await auth();
const userId = session?.user?.id;
const [aiSettings, userSettings] = await Promise.all([
getAISettings(userId),
getUserSettings(userId),
])
const htmlTheme = serverHtmlThemeState(userSettings.theme)
const serverAccent = userSettings.accentColor ?? '#A47148'
const serverTheme = normalizeThemeId(userSettings.theme || 'light')
const htmlStyle = {
'--color-brand-accent': serverAccent,
} as CSSProperties
return (
<html
suppressHydrationWarning
className={htmlTheme.className}
data-theme={htmlTheme.dataTheme}
data-server-theme={serverTheme}
data-server-accent={serverAccent}
style={htmlStyle}
>
<body className={`${inter.className} ${inter.variable} ${manrope.variable} ${playfair.variable} ${jetbrainsMono.variable} h-screen overflow-hidden`}>
<Script id="theme-init" src="/scripts/theme-init.js" strategy="beforeInteractive" />
<Script id="direction-init" src="/scripts/direction-init.js" strategy="beforeInteractive" />
<Script id="sw-cleanup" src="/scripts/sw-cleanup.js" strategy="afterInteractive" />
<SessionProviderWrapper>
<ErrorReporter />
<DirectionInitializer />
<ThemeInitializer theme={userSettings.theme} fontSize={aiSettings.fontSize} fontFamily={aiSettings.fontFamily} accentColor={userSettings.accentColor} />
{children}
<LanguageProvider initialLanguage="en">
<CookieConsentRoot />
</LanguageProvider>
<Toaster />
</SessionProviderWrapper>
</body>
</html>
);
}