nicht nutzbarer stand, header menü ist nicht intertia initialisiert. aber schick. codex änderungen noch enthalten.

This commit is contained in:
Codex Agent
2025-10-06 13:46:29 +02:00
parent d70faf7a9d
commit 5ee510b05d
29 changed files with 493 additions and 784 deletions

View File

@@ -13,15 +13,14 @@ const MarketingLayout: React.FC<MarketingLayoutProps> = ({ children, title }) =>
const { url } = page;
const { t } = useTranslation('marketing');
const i18n = useTranslation();
const { locale, localizedPath } = useLocalizedRoutes();
const { locale } = usePage().props as any;
const { localizedPath } = useLocalizedRoutes();
useEffect(() => {
const localeCandidate = locale || (url.startsWith('/en/') ? 'en' : 'de');
if (localeCandidate && i18n.i18n.language !== localeCandidate) {
i18n.i18n.changeLanguage(localeCandidate);
if (locale && i18n.i18n.language !== locale) {
i18n.i18n.changeLanguage(locale);
}
}, [url, i18n, locale]);
}, [locale, i18n]);
const marketing = page.props.translations?.marketing ?? {};
@@ -30,15 +29,19 @@ const MarketingLayout: React.FC<MarketingLayoutProps> = ({ children, title }) =>
return typeof value === 'string' ? value : fallback;
};
const activeLocale = locale || (url.startsWith('/en/') ? 'en' : 'de');
const activeLocale = locale || 'de';
const alternateLocale = activeLocale === 'de' ? 'en' : 'de';
const path = url.replace(/^\/(de|en)/, '');
const canonicalUrl = `https://fotospiel.app${localizedPath(path || '/')}`;
const canonicalUrl = `https://fotospiel.app${path || '/'}`;
const handleLocaleChange = (nextLocale: string) => {
const normalizedPath = url.replace(/^\/(de|en)/, '') || '/';
const destination = normalizedPath === '/' ? `/${nextLocale}` : `/${nextLocale}${normalizedPath}`;
router.visit(destination);
router.post('/set-locale', { locale: nextLocale }, {
preserveState: true,
replace: true,
onSuccess: () => {
i18n.i18n.changeLanguage(nextLocale);
},
});
};
return (
@@ -56,28 +59,28 @@ const MarketingLayout: React.FC<MarketingLayoutProps> = ({ children, title }) =>
/>
<meta property="og:url" content={canonicalUrl} />
<link rel="canonical" href={canonicalUrl} />
<link rel="alternate" hrefLang="de" href={`https://fotospiel.app/de${path}`} />
<link rel="alternate" hrefLang="en" href={`https://fotospiel.app/en${path}`} />
<link rel="alternate" hrefLang="x-default" href="https://fotospiel.app/de" />
<link rel="alternate" hreflang="de" href={`https://fotospiel.app/de${path}`} />
<link rel="alternate" hreflang="en" href={`https://fotospiel.app/en${path}`} />
<link rel="alternate" hreflang="x-default" href="https://fotospiel.app/" />
</Head>
<div className="min-h-screen bg-white">
<header className="bg-white shadow-sm">
<div className="container mx-auto px-4 py-4">
<nav className="flex justify-between items-center">
<Link href={localizedPath('/')} className="text-xl font-bold text-gray-900">
<Link href="/" className="text-xl font-bold text-gray-900">
Fotospiel
</Link>
<div className="hidden md:flex space-x-8">
<Link href={localizedPath('/')} className="text-gray-700 hover:text-gray-900">
<Link href="/" className="text-gray-700 hover:text-gray-900">
{t('nav.home')}
</Link>
<Link href={localizedPath('/packages')} className="text-gray-700 hover:text-gray-900">
<Link href="/packages" className="text-gray-700 hover:text-gray-900">
{t('nav.packages')}
</Link>
<Link href={localizedPath('/blog')} className="text-gray-700 hover:text-gray-900">
<Link href="/blog" className="text-gray-700 hover:text-gray-900">
{t('nav.blog')}
</Link>
<Link href={localizedPath('/kontakt')} className="text-gray-700 hover:text-gray-900">
<Link href="/kontakt" className="text-gray-700 hover:text-gray-900">
{t('nav.contact')}
</Link>
</div>
@@ -101,13 +104,13 @@ const MarketingLayout: React.FC<MarketingLayoutProps> = ({ children, title }) =>
<div className="container mx-auto px-4 text-center">
<p>&copy; 2025 Fotospiel. Alle Rechte vorbehalten.</p>
<div className="mt-4 space-x-4">
<Link href={localizedPath('/datenschutz')} className="hover:underline">
<Link href="/datenschutz" className="hover:underline">
{t('nav.privacy')}
</Link>
<Link href={localizedPath('/impressum')} className="hover:underline">
<Link href="/impressum" className="hover:underline">
{t('nav.impressum')}
</Link>
<Link href={localizedPath('/kontakt')} className="hover:underline">
<Link href="/kontakt" className="hover:underline">
{t('nav.contact')}
</Link>
</div>