mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 06:15:39 -04:00
Replace client-side session checks (useSession + router.replace) with a two-layer server-side approach: Next.js middleware performs a fast cookie presence check for all protected routes, and the (pages) layout does a full server-side session validation before rendering. Move login/register into a dedicated (auth) route group with its own minimal layout so they sit outside the authenticated shell. Lift the Toaster to the root layout so it remains available across all route groups.
45 lines
1022 B
TypeScript
45 lines
1022 B
TypeScript
import type { Metadata } from "next";
|
|
import { DM_Sans, DM_Serif_Display, Geist_Mono } from "next/font/google";
|
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
|
|
import "./globals.css";
|
|
import { Toaster } from "@/components/ui/sonner";
|
|
|
|
const dmSans = DM_Sans({
|
|
variable: "--font-dm-sans",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
const dmSerif = DM_Serif_Display({
|
|
variable: "--font-dm-serif",
|
|
weight: "400",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
const geistMono = Geist_Mono({
|
|
variable: "--font-geist-mono",
|
|
subsets: ["latin"],
|
|
});
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Sofa",
|
|
description: "Track your movies and TV shows",
|
|
};
|
|
|
|
export default function RootLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: React.ReactNode;
|
|
}>) {
|
|
return (
|
|
<html lang="en">
|
|
<body
|
|
className={`${dmSans.variable} ${dmSerif.variable} ${geistMono.variable} font-sans antialiased`}
|
|
>
|
|
<TooltipProvider>{children}</TooltipProvider>
|
|
<Toaster position="bottom-right" />
|
|
</body>
|
|
</html>
|
|
);
|
|
}
|