diyaa.de/app/[locale]/contact/page.tsx
2026-03-13 03:45:13 +01:00

73 lines
2.3 KiB
TypeScript

import type { Metadata } from "next";
import { getDictionary, isLocale, type Locale } from "@/lib/i18n";
import { buildPageMetadata } from "@/lib/metadata";
import { getContactChannels, isComingSoonMode } from "@/lib/site";
import { notFound, redirect } from "next/navigation";
export function generateMetadata({ params }: { params: { locale: string } }): Metadata {
if (!isLocale(params.locale)) {
return {};
}
return buildPageMetadata(params.locale, "contact");
}
export default function ContactPage({ params }: { params: { locale: string } }) {
if (!isLocale(params.locale)) {
notFound();
}
if (isComingSoonMode()) {
redirect(`/${params.locale}`);
}
const locale = params.locale as Locale;
const dictionary = getDictionary(locale);
const channels = getContactChannels(dictionary.contact);
return (
<section className="panel section-stack">
<div>
<p className="eyebrow">{dictionary.contact.kicker}</p>
<h1>{dictionary.contact.title}</h1>
<p className="lead">{dictionary.contact.description}</p>
</div>
<article className="card availability-card">
<h2>{dictionary.contact.availabilityTitle}</h2>
<p>{dictionary.contact.availabilityDescription}</p>
</article>
<div className="section-heading">
<h2>{dictionary.contact.channelsTitle}</h2>
</div>
<div className="split-grid contact-grid">
{channels.map((channel) => (
<article className="card contact-channel-card" key={channel.key}>
<div className="channel-meta">
<h3>{channel.name}</h3>
<p>{channel.hint}</p>
</div>
<p className="contact-value">{channel.value}</p>
{channel.href ? (
<a
href={channel.href}
className="card-link"
target={channel.external ? "_blank" : undefined}
rel={channel.external ? "noreferrer" : undefined}
>
{dictionary.contact.channelCta}
</a>
) : (
<span className="card-link is-disabled" aria-disabled="true">
{dictionary.contact.channelFallback}
</span>
)}
</article>
))}
</div>
</section>
);
}