import type { Metadata, Viewport } from "next"; import { Architects_Daughter, Caveat, Figtree, Inter, JetBrains_Mono, Orbitron, Righteous, VT323, } from "next/font/google"; import "./globals.css"; import { ThemeProvider } from "@/components/theme/theme-provider"; import { TooltipProvider } from "@/components/ui/tooltip"; import { Toaster } from "@/components/ui/sonner"; import { RegisterServiceWorker } from "@/components/pwa/register-sw"; import { auth } from "@/auth"; import { prisma } from "@/lib/db"; import { themeInitScript, type RawTheme } from "@/lib/themes"; /** UI type: Inter -- a neutral, highly legible humanist sans that reads * cleanly at small sizes (to-do lists, tables, nav). */ const inter = Inter({ variable: "--font-sans", subsets: ["latin"], }); /** Display type: Figtree -- a slightly friendlier, rounder geometric sans * for headings and wordmarks. Same family, one step of personality. */ const figtree = Figtree({ variable: "--font-heading", subsets: ["latin"], }); /** Code: JetBrains Mono, used for the markdown editor's monospace bits. */ const jetbrainsMono = JetBrains_Mono({ variable: "--font-mono", subsets: ["latin"], }); /** Blueprint theme's drafting face (see app/globals.css) -- a hand-drawn * architectural face, lettered like a drawing's title block. */ const architectsDaughter = Architects_Daughter({ variable: "--font-blueprint", subsets: ["latin"], weight: "400", }); /** Cyberpunk theme's pixel-terminal face (see app/globals.css). */ const vt323 = VT323({ variable: "--font-cyberpunk", subsets: ["latin"], weight: "400", }); /** Vaporwave theme's retro face (see app/globals.css) -- a rounded, * retro-futuristic face for the pastel synthwave look. */ const righteous = Righteous({ variable: "--font-vaporwave", subsets: ["latin"], weight: "400", }); /** Starfield theme's sci-fi face (see app/globals.css). */ const orbitron = Orbitron({ variable: "--font-starfield", subsets: ["latin"], }); /** Notebook theme's handwriting face (see app/globals.css) -- a casual pen * script for the stationery look. */ const caveat = Caveat({ variable: "--font-notebook", subsets: ["latin"], }); export const metadata: Metadata = { title: "Organize", description: "An extended to-do list and notes organizer.", manifest: "/manifest.webmanifest", icons: { icon: [{ url: "/icons/icon-192.png", sizes: "192x192", type: "image/png" }], apple: [{ url: "/icons/apple-touch-icon.png", sizes: "180x180", type: "image/png" }], }, appleWebApp: { capable: true, statusBarStyle: "default", title: "Organize", }, }; export const viewport: Viewport = { themeColor: [ { media: "(prefers-color-scheme: light)", color: "#fafafa" }, { media: "(prefers-color-scheme: dark)", color: "#22252b" }, ], }; export default async function RootLayout({ children }: LayoutProps<"/">) { // Per-user global theme (stored on the profile row; set from the theme // menu, see saveUserTheme in lib/actions/profile.ts). When signed in it // is authoritative: the no-FOUC script below applies it before first // paint and the ThemeProvider starts from it and persists changes back // -- so each account in a linked set keeps its own look in the same // browser across account toggles (a toggle is a full navigation, and // this layout re-renders for the new user). Anonymous visitors keep the // old localStorage-based behavior. const session = await auth(); let userTheme: RawTheme | undefined; if (session?.user) { // Stored as free text; valid values are enforced by ThemeSchema // (lib/validation/profile.ts) at write time, so the assertion is safe // -- same pattern as Project.theme. const profile = await prisma.user.findUnique({ where: { id: session.user.id }, select: { theme: true }, }); userTheme = (profile?.theme as RawTheme | null) ?? "system"; } return ( {/* Nineteen looks: ten light (Default, Sunset, Meadow, Honey, Rosé, Lavender, Slate, Blueprint, Vaporwave, Notebook) and nine dark (Dark, Ocean, Pine, Plum, Midnight, Ember, Rosewood, Cyberpunk, Starfield) -- complete token sets in app/globals.css; Blueprint, Cyberpunk, Vaporwave, Starfield, and Notebook additionally carry their own fonts, backgrounds, and animations. "system" resolves to Default/Dark by OS preference. No-FOUC theme restore: runs before first paint, applies the right class + color-scheme to . Signed-in users get their profile's stored theme (per account, so it survives account toggles); anonymous visitors get the browser's localStorage preference -- see themeInitScript in lib/themes.ts. */}