import type { Metadata } from "next"; import { ArrowLeft, CalendarDays, FolderKanban, Tag } from "lucide-react"; import Link from "next/link"; import { getTranslations } from "next-intl/server"; import { notFound } from "next/navigation"; import { Container } from "@/components/layout/container"; import { MotionFade } from "@/components/motion-fade"; import { routing } from "@/i18n/routing"; import { buildLocalizedMetadata } from "@/lib/metadata"; import { getLocalizedPath, resolveLocale } from "@/lib/locale"; import { getPortfolioItem, pickText, portfolioItems } from "@/lib/site-data"; import { AppCard } from "@/components/ui/app-card"; import { Button } from "@/components/ui/button"; import { CardContent } from "@/components/ui/card"; type PortfolioItemPageProps = { params: { locale: string; slug: string; }; }; export function generateStaticParams() { return routing.locales.flatMap((locale) => portfolioItems.map((item) => ({ locale, slug: item.slug, })), ); } export async function generateMetadata({ params: { locale, slug }, }: PortfolioItemPageProps): Promise { const localeKey = resolveLocale(locale); const item = getPortfolioItem(slug); if (!item) { return buildLocalizedMetadata({ locale: localeKey, pathname: `/portfolio/${slug}`, title: "Portfolio", description: "Portfolio item", }); } return buildLocalizedMetadata({ locale: localeKey, pathname: `/portfolio/${slug}`, title: pickText(item.title, localeKey), description: pickText(item.summary, localeKey), }); } export default async function PortfolioItemPage({ params: { locale, slug }, }: PortfolioItemPageProps) { const localeKey = resolveLocale(locale); const item = getPortfolioItem(slug); if (!item) { notFound(); } const t = await getTranslations({ locale: localeKey, namespace: "portfolioDetail" }); return (

{pickText(item.title, localeKey)}

{pickText(item.summary, localeKey)}

{[ { icon: Tag, label: pickText(item.category, localeKey), }, { icon: CalendarDays, label: item.year, }, { icon: FolderKanban, label: item.slug, }, ].map((meta) => { const Icon = meta.icon; return ( {meta.label} ); })}
{[ { title: t("challenge"), text: t("challengeText"), }, { title: t("solution"), text: t("solutionText"), }, { title: t("outcome"), text: t("outcomeText"), }, ].map((section, index) => (

{section.title}

{section.text}

))}
); }