Files
portfolio/app/layout.tsx
denshooter dacec18956
All checks were successful
CI / CD / test-build (push) Successful in 10m10s
CI / CD / deploy-dev (push) Successful in 1m46s
CI / CD / deploy-production (push) Has been skipped
perf: eliminate next-themes and framer-motion from initial JS bundle
- Replace next-themes (38 KiB) with a tiny custom ThemeProvider (~< 1 KiB)
  using localStorage + classList.toggle for theme management
- Add FOUC-prevention inline script in layout.tsx to apply saved theme
  before React hydrates
- Remove framer-motion from Header.tsx: nav entry now uses CSS slideDown
  keyframe, mobile menu uses CSS opacity/translate transitions
- Remove framer-motion from ThemeToggle.tsx: use Tailwind hover/active scale
- Remove framer-motion from legal-notice and privacy-policy pages
- Update useTheme import in ThemeToggle to use custom ThemeProvider
- Add slideDown keyframe to tailwind.config.ts
- Update tests to mock custom ThemeProvider instead of next-themes

Result: framer-motion moves from "First Load JS shared by all" to lazy
chunks; next-themes chunk eliminated entirely; -38 KiB from initial bundle

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 17:39:29 +01:00

113 lines
3.1 KiB
TypeScript

import "./globals.css";
import { Metadata } from "next";
import { Inter, Playfair_Display } from "next/font/google";
import React from "react";
import ClientProviders from "./components/ClientProviders";
import ShaderGradientBackground from "./components/ShaderGradientBackground";
import { cookies } from "next/headers";
import { getBaseUrl } from "@/lib/seo";
const inter = Inter({
variable: "--font-inter",
subsets: ["latin"],
display: "swap",
adjustFontFallback: true,
});
const playfair = Playfair_Display({
variable: "--font-playfair",
subsets: ["latin"],
display: "swap",
adjustFontFallback: true,
});
export default async function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
const cookieStore = await cookies();
const locale = cookieStore.get("NEXT_LOCALE")?.value || "en";
return (
<html lang={locale} suppressHydrationWarning>
<head>
<meta charSet="utf-8" />
{/* Prevent flash of unstyled theme — reads localStorage before React hydrates */}
<script dangerouslySetInnerHTML={{ __html: `try{var t=localStorage.getItem('theme');if(t==='dark')document.documentElement.classList.add('dark');}catch(e){}` }} />
</head>
<body className={`${inter.variable} ${playfair.variable}`} suppressHydrationWarning>
<div className="grain-overlay" aria-hidden="true" />
<ShaderGradientBackground />
<ClientProviders>{children}</ClientProviders>
</body>
</html>
);
}
export const metadata: Metadata = {
metadataBase: new URL(getBaseUrl()),
title: {
default: "Dennis Konkol | Portfolio",
template: "%s | Dennis Konkol",
},
description:
"Portfolio of Dennis Konkol, a student and software engineer based in Osnabrück, Germany. Passionate about technology, coding, and solving real-world problems.",
keywords: [
"Dennis Konkol",
"Software Engineer",
"Portfolio",
"Student",
"Web Development",
"Full Stack Developer",
"Osnabrück",
"Germany",
"React",
"Next.js",
"TypeScript",
],
authors: [{ name: "Dennis Konkol", url: "https://dk0.dev" }],
creator: "Dennis Konkol",
publisher: "Dennis Konkol",
robots: {
index: true,
follow: true,
googleBot: {
index: true,
follow: true,
"max-video-preview": -1,
"max-image-preview": "large",
"max-snippet": -1,
},
},
openGraph: {
title: "Dennis Konkol | Portfolio",
description:
"Explore my projects and contact me for collaboration opportunities!",
url: "https://dk0.dev",
siteName: "Dennis Konkol Portfolio",
images: [
{
url: "https://dk0.dev/api/og",
width: 1200,
height: 630,
alt: "Dennis Konkol Portfolio",
},
],
locale: "en_US",
type: "website",
},
twitter: {
card: "summary_large_image",
title: "Dennis Konkol | Portfolio",
description: "Student & Software Engineer based in Osnabrück, Germany.",
images: ["https://dk0.dev/api/og"],
creator: "@denshooter",
},
verification: {
google: process.env.NEXT_PUBLIC_GOOGLE_VERIFICATION,
},
alternates: {
canonical: "https://dk0.dev",
},
};