This commit is contained in:
@@ -1,8 +1,15 @@
|
||||
import type { Metadata } from "next";
|
||||
import { CheckCircle2 } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
|
||||
import { Container } from "@/components/layout/container";
|
||||
import { MotionFade } from "@/components/motion-fade";
|
||||
import { resolveLocale } from "@/lib/site-data";
|
||||
import { buildLocalizedMetadata } from "@/lib/metadata";
|
||||
import { getLocalizedPath, resolveLocale } from "@/lib/locale";
|
||||
import { AppCard } from "@/components/ui/app-card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { CardContent } from "@/components/ui/card";
|
||||
|
||||
type SuccessPageProps = {
|
||||
params: {
|
||||
@@ -10,51 +17,47 @@ type SuccessPageProps = {
|
||||
};
|
||||
};
|
||||
|
||||
export default function SuccessPage({ params: { locale } }: SuccessPageProps) {
|
||||
export async function generateMetadata({
|
||||
params: { locale },
|
||||
}: SuccessPageProps): Promise<Metadata> {
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "successPage" });
|
||||
|
||||
const copy =
|
||||
localeKey === "de"
|
||||
? {
|
||||
title: "Danke fuer deine Nachricht",
|
||||
text: "Wir haben deine Anfrage erhalten und melden uns zeitnah.",
|
||||
home: "Zur Startseite",
|
||||
contact: "Zur Kontaktseite",
|
||||
}
|
||||
: {
|
||||
title: "Thank you for your message",
|
||||
text: "We received your request and will reply shortly.",
|
||||
home: "Go to homepage",
|
||||
contact: "Back to contact",
|
||||
};
|
||||
return buildLocalizedMetadata({
|
||||
locale: localeKey,
|
||||
pathname: "/success",
|
||||
title: t("title"),
|
||||
description: t("text"),
|
||||
});
|
||||
}
|
||||
|
||||
export default async function SuccessPage({ params: { locale } }: SuccessPageProps) {
|
||||
const localeKey = resolveLocale(locale);
|
||||
const t = await getTranslations({ locale: localeKey, namespace: "successPage" });
|
||||
|
||||
return (
|
||||
<div className="mx-auto flex w-full max-w-4xl px-4 py-12 sm:px-6 lg:px-8 lg:py-16">
|
||||
<Container size="narrow" className="py-12 lg:py-16">
|
||||
<MotionFade className="w-full">
|
||||
<section className="w-full rounded-3xl border border-default bg-surface p-8 text-center ">
|
||||
<CheckCircle2 className="mx-auto h-12 w-12 text-emerald-500" />
|
||||
<h1 className="mt-4 text-3xl font-semibold text-fg sm:text-4xl">
|
||||
{copy.title}
|
||||
</h1>
|
||||
<p className="mx-auto mt-3 max-w-2xl text-base text-muted">
|
||||
{copy.text}
|
||||
</p>
|
||||
<div className="mt-6 flex flex-wrap items-center justify-center gap-3">
|
||||
<Link
|
||||
href={`/${localeKey}`}
|
||||
className="inline-flex rounded-lg bg-inverse px-4 py-2.5 text-sm font-medium text-inverse transition hover:opacity-90 "
|
||||
>
|
||||
{copy.home}
|
||||
</Link>
|
||||
<Link
|
||||
href={`/${localeKey}/contact`}
|
||||
className="inline-flex rounded-lg border border-strong px-4 py-2.5 text-sm font-medium text-muted-strong transition hover-surface-soft text-muted-strong"
|
||||
>
|
||||
{copy.contact}
|
||||
</Link>
|
||||
</div>
|
||||
</section>
|
||||
<AppCard level={3}>
|
||||
<CardContent className="p-8 text-center">
|
||||
<CheckCircle2 className="mx-auto h-12 w-12 text-status-success" />
|
||||
<h1 className="mt-4 text-3xl font-semibold text-foreground sm:text-4xl">
|
||||
{t("title")}
|
||||
</h1>
|
||||
<p className="mx-auto mt-3 max-w-2xl text-base text-muted-foreground">
|
||||
{t("text")}
|
||||
</p>
|
||||
<div className="mt-6 flex flex-wrap items-center justify-center gap-3">
|
||||
<Button asChild>
|
||||
<Link href={getLocalizedPath(localeKey)}>{t("home")}</Link>
|
||||
</Button>
|
||||
<Button asChild variant="outline">
|
||||
<Link href={getLocalizedPath(localeKey, "/contact")}>{t("contact")}</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</AppCard>
|
||||
</MotionFade>
|
||||
</div>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user