diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index d657292e..59b0a001 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -7,11 +7,11 @@ import AnalyticsShell from '@/components/analytics/AnalyticsShell'; import { Metadata, Viewport } from 'next'; import { NextIntlClientProvider } from 'next-intl'; import { getMessages } from 'next-intl/server'; -import dynamic from 'next/dynamic'; import { Suspense } from 'react'; import '../../styles/globals.css'; import { SITE_URL } from '@/lib/schema'; import { config } from '@/lib/config'; +import FeedbackClientWrapper from '@/components/FeedbackClientWrapper'; import { setRequestLocale } from 'next-intl/server'; import { Inter } from 'next/font/google'; @@ -127,13 +127,6 @@ export default async function Layout(props: { // Read directly from process.env — bypasses all abstraction to guarantee correctness const feedbackEnabled = process.env.NEXT_PUBLIC_FEEDBACK_ENABLED === 'true'; - const FeedbackOverlay = feedbackEnabled - ? dynamic( - () => import('@mintel/next-feedback/FeedbackOverlay').then((mod) => mod.FeedbackOverlay), - { ssr: false }, - ) - : null; - return ( @@ -158,7 +151,7 @@ export default async function Layout(props: { - {FeedbackOverlay && } + diff --git a/components/FeedbackClientWrapper.tsx b/components/FeedbackClientWrapper.tsx new file mode 100644 index 00000000..b4113ad8 --- /dev/null +++ b/components/FeedbackClientWrapper.tsx @@ -0,0 +1,18 @@ +'use client'; + +import dynamic from 'next/dynamic'; + +const FeedbackOverlay = dynamic( + () => import('@mintel/next-feedback/FeedbackOverlay').then((mod) => mod.FeedbackOverlay), + { ssr: false }, +); + +interface FeedbackClientWrapperProps { + feedbackEnabled: boolean; +} + +export default function FeedbackClientWrapper({ feedbackEnabled }: FeedbackClientWrapperProps) { + if (!feedbackEnabled) return null; + + return ; +}