import type { Metadata } from "next"; import { ArrowLeft, ArrowUpRight, CalendarDays, FolderKanban, Tag, UserRound } from "lucide-react"; import Link from "next/link"; import Image from "next/image"; import { getTranslations } from "next-intl/server"; import { notFound } from "next/navigation"; import { Container } from "@/components/layout/container"; import { PageHero } from "@/components/layout/page-hero"; import { MotionFade } from "@/components/motion-fade"; import { buildLocalizedMetadata } from "@/lib/metadata"; import { getLocalizedPath, resolveLocale } from "@/lib/locale"; import { getLocalizedValue, getPublishedPortfolioProjectBySlug, } from "@/lib/portfolio"; 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 const dynamic = "force-dynamic"; function PortfolioImage({ src, alt, className, width, height, }: { src: string; alt: string; className: string; width: number; height: number; }) { return ( {alt} ); } function renderSectionContent( section: NonNullable>>["sections"][number], localeKey: ReturnType, t: Awaited>, ) { const title = getLocalizedValue(section.title, localeKey); const body = getLocalizedValue(section.body, localeKey); if (section.type === "GALLERY") { return (

{title}

{section.imagePath ? ( ) : (
No image configured.
)}
); } if (section.type === "LINK") { return (

{title}

{body ? (

{body}

) : null} {section.linkUrl ? ( ) : null}
); } if (section.type === "STATS" || section.type === "DELIVERABLES") { return (

{title}

{body}

); } return (

{title}

{body}

); } export async function generateMetadata({ params: { locale, slug }, }: PortfolioItemPageProps): Promise { const localeKey = resolveLocale(locale); const item = await getPublishedPortfolioProjectBySlug(slug); if (!item) { return await buildLocalizedMetadata({ locale: localeKey, pathname: `/portfolio/${slug}`, title: "Portfolio", description: "Portfolio item", }); } return await buildLocalizedMetadata({ locale: localeKey, pathname: `/portfolio/${slug}`, title: getLocalizedValue(item.title, localeKey), description: getLocalizedValue(item.summary, localeKey), }); } export default async function PortfolioItemPage({ params: { locale, slug }, }: PortfolioItemPageProps) { const localeKey = resolveLocale(locale); const item = await getPublishedPortfolioProjectBySlug(slug); if (!item) { notFound(); } const t = await getTranslations({ locale: localeKey, namespace: "portfolioDetail" }); return ( <>

{getLocalizedValue(item.title, localeKey)}

{getLocalizedValue(item.summary, localeKey)}

{item.coverImagePath ? (
) : null}
{[ { icon: Tag, label: getLocalizedValue(item.category.name, localeKey), }, { icon: CalendarDays, label: String(item.projectYear), }, { icon: FolderKanban, label: getLocalizedValue(item.serviceLabel, localeKey), }, { icon: UserRound, label: item.clientName, }, ].map((meta) => { const Icon = meta.icon; return ( {meta.label} ); })}
{item.previewUrl ? (
) : null}
{item.sections.map((section, index) => ( {renderSectionContent(section, localeKey, t)} ))}
{item.assets.length > 0 ? (

{t("gallery")}

{item.assets.map((asset) => (
{asset.kind === "IMAGE" ? ( ) : (

{getLocalizedValue(asset.alt, localeKey)}

)}
))}
) : null}
); }