perf: optimize framer-motion bundle size and memoize dictionary fetching

- Wrap getDictionary with React cache to prevent redundant JSON parsing on the server
- Create MotionProvider to globally initialize framer-motion LazyMotion with domAnimation
- Replace standard 'motion' imports with 'm' across all animated client components (HomeClient, Navbar, GaleriClient, SSSClient, card, text-reveal) to drastically reduce First Load JS size
This commit is contained in:
mstfyldz
2026-06-04 12:50:23 +03:00
parent e1d8bae5a4
commit acf01c81fa
9 changed files with 59 additions and 44 deletions
+6 -3
View File
@@ -2,6 +2,7 @@ import type { Metadata } from "next";
import { Cormorant_Garamond, Montserrat } from "next/font/google";
import Navbar from "../components/Navbar";
import Footer from "../components/Footer";
import { MotionProvider } from "../components/MotionProvider";
import "../globals.css";
import { Locale, getDictionary } from "../dictionaries";
@@ -66,9 +67,11 @@ export default async function RootLayout({
/>
</head>
<body className="min-h-full flex flex-col">
<Navbar lang={locale} dict={dict.navigation} />
<main className="flex-1">{children}</main>
<Footer lang={locale} dict={dict.footer} />
<MotionProvider>
<Navbar lang={locale} dict={dict.navigation} />
<main className="flex-1">{children}</main>
<Footer lang={locale} dict={dict.footer} />
</MotionProvider>
</body>
</html>
);