feat: complete MDX migration, stabilize environment & verify via E2E tests
Former-commit-id: ec3e64156a2e182535cbdcf0d975cd54603a517d
This commit is contained in:
@@ -2,7 +2,6 @@ import { Footer } from '@/components/layout/Footer';
|
||||
import { Header } from '@/components/layout/Header';
|
||||
import JsonLd from '@/components/JsonLd';
|
||||
import SkipLink from '@/components/SkipLink';
|
||||
import CMSConnectivityNotice from '@/components/CMSConnectivityNotice';
|
||||
import AnalyticsShell from '@/components/analytics/AnalyticsShell';
|
||||
import { Metadata, Viewport } from 'next';
|
||||
import { NextIntlClientProvider } from 'next-intl';
|
||||
@@ -12,8 +11,7 @@ import { SITE_URL } from '@/lib/schema';
|
||||
import FeedbackClientWrapper from '@/components/FeedbackClientWrapper';
|
||||
import { setRequestLocale } from 'next-intl/server';
|
||||
import { Inter } from 'next/font/google';
|
||||
import { getPayload } from 'payload';
|
||||
import configPromise from '@payload-config';
|
||||
import { mapFileSlugToTranslated } from '@/lib/slugs';
|
||||
|
||||
const inter = Inter({
|
||||
subsets: ['latin'],
|
||||
@@ -76,36 +74,34 @@ export default async function Layout(props: {
|
||||
const safeLocale = supportedLocales.includes(localeStr) ? localeStr : 'en';
|
||||
|
||||
setRequestLocale(safeLocale);
|
||||
|
||||
|
||||
let messages: Record<string, any> = {};
|
||||
try {
|
||||
messages = await getMessages();
|
||||
} catch {
|
||||
} catch (err) {
|
||||
console.error('[Layout] Failed to load messages:', err);
|
||||
messages = {};
|
||||
}
|
||||
|
||||
// Fetch navigation and company info from Payload Global Settings
|
||||
const payload = await getPayload({ config: configPromise });
|
||||
const settings = await payload.findGlobal({
|
||||
slug: 'settings',
|
||||
locale: safeLocale as any,
|
||||
}).catch(() => null);
|
||||
|
||||
const navLinks = (settings?.mainNav && settings.mainNav.length > 0)
|
||||
? settings.mainNav.map((n) => ({
|
||||
label: n.label,
|
||||
url: n.url,
|
||||
}))
|
||||
: [
|
||||
{ label: 'Kompetenzen', url: `/${safeLocale}/kompetenzen` },
|
||||
{ label: 'Über uns', url: `/${safeLocale}/ueber-uns` },
|
||||
{ label: 'Karriere & Messen', url: `/${safeLocale}/karriere` }
|
||||
];
|
||||
|
||||
|
||||
const navLinks = [
|
||||
{
|
||||
label: safeLocale === 'de' ? 'Kompetenzen' : 'Competencies',
|
||||
url: `/${safeLocale}/${await mapFileSlugToTranslated('kompetenzen', safeLocale)}`
|
||||
},
|
||||
{
|
||||
label: safeLocale === 'de' ? 'Über uns' : 'About Us',
|
||||
url: `/${safeLocale}/${await mapFileSlugToTranslated('ueber-uns', safeLocale)}`
|
||||
},
|
||||
{
|
||||
label: safeLocale === 'de' ? 'Karriere & Messen' : 'Careers & Events',
|
||||
url: `/${safeLocale}/${await mapFileSlugToTranslated('karriere', safeLocale)}`
|
||||
}
|
||||
];
|
||||
|
||||
const companyInfo = {
|
||||
contactEmail: settings?.contactEmail || 'info@e-tib.com',
|
||||
contactPhone: settings?.contactPhone || '+49 15207230518',
|
||||
address: settings?.address || 'Gewerbestraße 22\\n03172 Guben'
|
||||
contactEmail: 'info@e-tib.com',
|
||||
contactPhone: '+49 15207230518',
|
||||
address: 'Gewerbestraße 22\n03172 Guben'
|
||||
};
|
||||
|
||||
// Pick only the namespaces required by client components to reduce the hydration payload size
|
||||
@@ -185,7 +181,6 @@ export default async function Layout(props: {
|
||||
|
||||
<Footer companyInfo={companyInfo} />
|
||||
<JsonLd />
|
||||
<CMSConnectivityNotice />
|
||||
<AnalyticsShell />
|
||||
{feedbackEnabled && <FeedbackClientWrapper feedbackEnabled={feedbackEnabled} />}
|
||||
</NextIntlClientProvider>
|
||||
|
||||
Reference in New Issue
Block a user