mirror of
https://github.com/ANewProfile/breadcrumbs.git
synced 2026-09-23 07:19:56 +02:00
70 lines
2.4 KiB
TypeScript
70 lines
2.4 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Geist, Geist_Mono } from "next/font/google";
|
|
import { Header } from "./components/Header";
|
|
import { Footer } from "./components/Footer";
|
|
import { CookieConsent } from "./components/CookieConsent";
|
|
import { fetchCurrentUser, fetchDevModeEnabled } from "@/lib/api";
|
|
import { SITE_URL } from "@/lib/site";
|
|
import "./globals.css";
|
|
|
|
const geistSans = Geist({
|
|
variable: "--font-geist-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
variable: "--font-geist-mono",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
metadataBase: new URL(SITE_URL),
|
|
title: {
|
|
default: "Breadcrumbs — auto-schedule your to-do list",
|
|
template: "%s — Breadcrumbs",
|
|
},
|
|
description:
|
|
"Breadcrumbs reads your Google Calendar, finds your free time, and automatically schedules your to-do list into it.",
|
|
alternates: {
|
|
canonical: "/",
|
|
},
|
|
};
|
|
|
|
export default async function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
const [user, devModeEnabled] = await Promise.all([fetchCurrentUser(), fetchDevModeEnabled()]);
|
|
|
|
return (
|
|
<html
|
|
lang="en"
|
|
className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
|
|
suppressHydrationWarning
|
|
>
|
|
<body className="min-h-full flex flex-col bg-white dark:bg-zinc-950">
|
|
{/* Raw (not next/script) so it's a literal blocking <script> tag the
|
|
browser executes synchronously while parsing, before any Next.js
|
|
runtime chunk loads — avoiding a race where the page paints (or
|
|
hydrates) in light mode before the stored theme is applied. */}
|
|
<script
|
|
dangerouslySetInnerHTML={{
|
|
__html: `(function(){try{var t=localStorage.getItem('breadcrumbs_theme');if(t!=='light'&&t!=='dark'){t=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';}if(t==='dark')document.documentElement.classList.add('dark');}catch(e){}})();`,
|
|
}}
|
|
/>
|
|
<a
|
|
href="#main-content"
|
|
className="sr-only focus:not-sr-only focus:absolute focus:top-2 focus:left-2 focus:z-50 focus:px-3 focus:py-2 focus:rounded-lg focus:bg-indigo-600 focus:text-white focus:text-sm focus:font-medium"
|
|
>
|
|
Skip to main content
|
|
</a>
|
|
<Header user={user} devModeEnabled={devModeEnabled} />
|
|
{children}
|
|
<Footer />
|
|
<CookieConsent />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|