import { prisma } from "@/lib/prisma"; import ProjectDetailClient from "@/app/_ui/ProjectDetailClient"; import { notFound } from "next/navigation"; import type { Metadata } from "next"; import { getLanguageAlternates, toAbsoluteUrl } from "@/lib/seo"; export const revalidate = 300; export async function generateMetadata({ params, }: { params: Promise<{ locale: string; slug: string }>; }): Promise { const { locale, slug } = await params; const languages = getLanguageAlternates({ pathWithoutLocale: `projects/${slug}` }); return { alternates: { canonical: toAbsoluteUrl(`/${locale}/projects/${slug}`), languages, }, }; } export default async function ProjectPage({ params, }: { params: Promise<{ locale: string; slug: string }>; }) { const { locale, slug } = await params; const project = await prisma.project.findFirst({ where: { slug, published: true }, include: { translations: { where: { locale }, select: { title: true, description: true }, }, }, }); if (!project) return notFound(); const tr = project.translations?.[0]; const { translations: _translations, ...rest } = project; const localized = { ...rest, title: tr?.title ?? project.title, description: tr?.description ?? project.description, }; return ; }