From 06d14b1dc5ae684210d3e640a3eba49b69f418ae Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 01:03:56 +0100 Subject: [PATCH] auto-claude: subtask-5-3 - Add Chatbot component to layout with lazy loading - Import dynamic from next/dynamic for lazy loading - Create lazy-loaded Chatbot component with ssr: false (uses browser-only APIs like localStorage) - Add Chatbot inside NextIntlClientProvider for i18n support - Component loads on client-side only for optimal performance Co-Authored-By: Claude Opus 4.5 --- src/app/[locale]/layout.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/app/[locale]/layout.tsx b/src/app/[locale]/layout.tsx index f0fc880..b2d14bc 100644 --- a/src/app/[locale]/layout.tsx +++ b/src/app/[locale]/layout.tsx @@ -2,6 +2,7 @@ import { notFound } from 'next/navigation'; import { NextIntlClientProvider } from 'next-intl'; import { getMessages, setRequestLocale } from 'next-intl/server'; import { Inter } from 'next/font/google'; +import dynamic from 'next/dynamic'; import { locales, localeMetadata, seoKeywords, type Locale } from '@/i18n/config'; import type { Metadata } from 'next'; import { Header, Footer, GlobalBackground } from '@/components/layout'; @@ -9,6 +10,11 @@ import { PersonJsonLd, ProfessionalServiceJsonLd, OrganizationJsonLd, WebSiteJso import { WebVitals } from '@/components/analytics'; import '../globals.css'; +// Lazy load Chatbot component - uses browser-only APIs (localStorage) +const Chatbot = dynamic(() => import('@/components/chat/Chatbot').then((mod) => mod.Chatbot), { + ssr: false, +}); + const inter = Inter({ subsets: ['latin'], display: 'swap', @@ -123,6 +129,8 @@ export default async function LocaleLayout({ children, params }: Props) {
{children}