ssr
This commit is contained in:
@@ -2,10 +2,9 @@ import ContactForm from '@/components/ContactForm';
|
|||||||
import JsonLd from '@/components/JsonLd';
|
import JsonLd from '@/components/JsonLd';
|
||||||
import { Container, Heading, Section } from '@/components/ui';
|
import { Container, Heading, Section } from '@/components/ui';
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
import { useTranslations } from 'next-intl';
|
|
||||||
import { getTranslations } from 'next-intl/server';
|
import { getTranslations } from 'next-intl/server';
|
||||||
|
import { Suspense } from 'react';
|
||||||
import dynamic from 'next/dynamic';
|
import dynamic from 'next/dynamic';
|
||||||
|
|
||||||
const LeafletMap = dynamic(() => import('@/components/LeafletMap'), {
|
const LeafletMap = dynamic(() => import('@/components/LeafletMap'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
loading: () => (
|
loading: () => (
|
||||||
@@ -27,30 +26,48 @@ export async function generateMetadata({ params: { locale } }: ContactPageProps)
|
|||||||
title: t('title'),
|
title: t('title'),
|
||||||
description: t('subtitle'),
|
description: t('subtitle'),
|
||||||
alternates: {
|
alternates: {
|
||||||
canonical: `/${locale}/contact`,
|
canonical: `https://klz-cables.com/${locale}/contact`,
|
||||||
languages: {
|
languages: {
|
||||||
'de': '/de/contact',
|
'de-DE': '/de/contact',
|
||||||
'en': '/en/contact',
|
'en-US': '/en/contact',
|
||||||
'x-default': '/en/contact',
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
openGraph: {
|
openGraph: {
|
||||||
title: `${t('title')} | KLZ Cables`,
|
title: `${t('title')} | KLZ Cables`,
|
||||||
description: t('subtitle'),
|
description: t('subtitle'),
|
||||||
url: `https://klz-cables.com/${locale}/contact`,
|
url: `https://klz-cables.com/${locale}/contact`,
|
||||||
|
siteName: 'KLZ Cables',
|
||||||
|
images: [
|
||||||
|
{
|
||||||
|
url: 'https://klz-cables.com/logo.png',
|
||||||
|
width: 1200,
|
||||||
|
height: 630,
|
||||||
|
alt: 'KLZ Cables Contact',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
locale: `${locale.toUpperCase()}_DE`,
|
||||||
|
type: 'website',
|
||||||
},
|
},
|
||||||
twitter: {
|
twitter: {
|
||||||
card: 'summary_large_image',
|
card: 'summary_large_image',
|
||||||
title: `${t('title')} | KLZ Cables`,
|
title: `${t('title')} | KLZ Cables`,
|
||||||
description: t('subtitle'),
|
description: t('subtitle'),
|
||||||
|
images: ['https://klz-cables.com/logo.png'],
|
||||||
|
},
|
||||||
|
robots: {
|
||||||
|
index: true,
|
||||||
|
follow: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function ContactPage() {
|
export async function generateStaticParams() {
|
||||||
const t = useTranslations('Contact');
|
return [{ locale: 'de' }, { locale: 'en' }];
|
||||||
const locale = t('locale') || 'en'; // Fallback if needed, but usually passed via params
|
}
|
||||||
|
|
||||||
|
export default async function ContactPage({ params }: ContactPageProps) {
|
||||||
|
const { locale } = params;
|
||||||
|
const t = await getTranslations({ locale, namespace: 'Contact' });
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col min-h-screen bg-neutral-light">
|
<div className="flex flex-col min-h-screen bg-neutral-light">
|
||||||
<JsonLd
|
<JsonLd
|
||||||
@@ -194,7 +211,9 @@ export default function ContactPage() {
|
|||||||
|
|
||||||
{/* Contact Form */}
|
{/* Contact Form */}
|
||||||
<div className="lg:col-span-7">
|
<div className="lg:col-span-7">
|
||||||
<ContactForm />
|
<Suspense fallback={<div className="animate-pulse bg-neutral-medium h-96 rounded-2xl md:rounded-3xl"></div>}>
|
||||||
|
<ContactForm />
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Container>
|
</Container>
|
||||||
@@ -202,11 +221,15 @@ export default function ContactPage() {
|
|||||||
|
|
||||||
{/* Map Section */}
|
{/* Map Section */}
|
||||||
<section className="h-[300px] md:h-[500px] bg-neutral-medium relative overflow-hidden grayscale hover:grayscale-0 transition-all duration-1000">
|
<section className="h-[300px] md:h-[500px] bg-neutral-medium relative overflow-hidden grayscale hover:grayscale-0 transition-all duration-1000">
|
||||||
<LeafletMap
|
<Suspense fallback={<div className="h-full w-full bg-neutral-medium animate-pulse flex items-center justify-center">
|
||||||
address={t('info.address')}
|
<div className="text-primary font-medium">Loading Map...</div>
|
||||||
lat={48.8164}
|
</div>}>
|
||||||
lng={9.4168}
|
<LeafletMap
|
||||||
/>
|
address={t('info.address')}
|
||||||
|
lat={47.8407}
|
||||||
|
lng={11.1421}
|
||||||
|
/>
|
||||||
|
</Suspense>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { Container, Button, Section, Heading } from '@/components/ui';
|
import { Container, Button, Section, Heading } from '@/components/ui';
|
||||||
|
|||||||
Reference in New Issue
Block a user