import type { Metadata } from "next";
import { getTranslations } from "next-intl/server";

import { Container } from "@/components/layout/container";
import { PageHero } from "@/components/layout/page-hero";
import { AppCard } from "@/components/ui/app-card";
import { FALLBACK_LOCALE, resolveLocale } from "@/lib/locale";
import { buildLocalizedMetadata } from "@/lib/metadata";

type AboutPageProps = {
  params: Promise<{
    locale: string;
  }>;
};

export const dynamic = "force-dynamic";

export async function generateMetadata({ params }: AboutPageProps): Promise<Metadata> {
  const { locale } = await params;
  const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
  const t = await getTranslations({ locale: localeKey, namespace: "aboutPage" });

  return await buildLocalizedMetadata({
    locale: localeKey,
    pathname: "/about",
    title: t("title"),
    description: t("description"),
  });
}

export default async function AboutPage({ params }: AboutPageProps) {
  const { locale } = await params;
  const localeKey = resolveLocale(locale, FALLBACK_LOCALE);
  const t = await getTranslations({ locale: localeKey, namespace: "aboutPage" });

  return (
    <>
      <PageHero
        locale={localeKey}
        badge={t("heroEyebrow")}
        title={t("title")}
        description={t("description")}
      />

      <Container className="pb-16 lg:pb-20">
        <AppCard level={3} padding="lg" className="mx-auto max-w-3xl text-center">
          <p className="text-lg font-medium text-foreground">{t("placeholder")}</p>
        </AppCard>
      </Container>
    </>
  );
}
