From 8eb9f24b33f3873fcc0a5c93d9b17af01c5844f3 Mon Sep 17 00:00:00 2001 From: Unchained Date: Tue, 31 Mar 2026 12:03:34 +0200 Subject: [PATCH 1/2] feat(performance): Core Web Vitals optimizations - Font optimization: Replace @font-face with next/font/google (DM Sans, Inter) for faster font loading and no render-blocking - Image optimization: Add Unsplash to remotePatterns, configure AVIF/WebP formats, add device/image sizes - Convert native tags to next/image with proper sizing and priority for LCP images - Add optimizePackageImports for lucide-react and framer-motion to reduce bundle size - Fix CLS: Urgency message uses fixed min-height instead of animated height - Fix CLS: ProductCard quick-add button uses opacity instead of translate for hover - Convert HeroVideo scroll indicator to CSS animation - Script loading: Rybbit uses lazyOnload strategy for better INP --- next.config.ts | 11 ++++++++ src/app/[locale]/about/page.tsx | 8 ++++-- src/app/[locale]/layout.tsx | 2 +- src/app/[locale]/page.tsx | 7 +++-- src/app/globals.css | 35 ++++++++++-------------- src/app/layout.tsx | 15 +++++++++- src/components/home/HeroVideo.tsx | 35 ++++++++++++------------ src/components/product/ProductCard.tsx | 9 +++--- src/components/product/ProductDetail.tsx | 33 ++++++++++++---------- 9 files changed, 92 insertions(+), 63 deletions(-) diff --git a/next.config.ts b/next.config.ts index 18fbbc2..b925f27 100644 --- a/next.config.ts +++ b/next.config.ts @@ -31,6 +31,9 @@ const nextConfig: NextConfig = { ]; }, images: { + formats: ["image/avif", "image/webp"], + deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048], + imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], remotePatterns: [ { protocol: "https", @@ -52,8 +55,16 @@ const nextConfig: NextConfig = { hostname: "**.saleor.cloud", pathname: "/**", }, + { + protocol: "https", + hostname: "images.unsplash.com", + pathname: "/**", + }, ], }, + experimental: { + optimizePackageImports: ["lucide-react", "framer-motion"], + }, }; export default withNextIntl(nextConfig); diff --git a/src/app/[locale]/about/page.tsx b/src/app/[locale]/about/page.tsx index 7a6b977..14f4f84 100644 --- a/src/app/[locale]/about/page.tsx +++ b/src/app/[locale]/about/page.tsx @@ -5,6 +5,7 @@ import { getPageMetadata } from "@/lib/i18n/pageMetadata"; import { isValidLocale, DEFAULT_LOCALE, type Locale } from "@/lib/i18n/locales"; import { getPageKeywords } from "@/lib/seo/keywords"; import { Metadata } from "next"; +import Image from "next/image"; const baseUrl = process.env.NEXT_PUBLIC_SITE_URL || "https://manoonoils.com"; @@ -67,10 +68,13 @@ export default async function AboutPage({ params }: AboutPageProps) {
- {metadata.about.productionAlt}
diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index 0d891c3..164197c 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -60,7 +60,7 @@ export default async function LocaleLayout({