Files
portfolio/app/[locale]/projects/page.tsx
2026-01-12 14:36:10 +00:00

37 lines
870 B
TypeScript

import { prisma } from "@/lib/prisma";
import ProjectsPageClient from "@/app/_ui/ProjectsPageClient";
export const revalidate = 300;
export default async function ProjectsPage({
params,
}: {
params: Promise<{ locale: string }>;
}) {
const { locale } = await params;
const projects = await prisma.project.findMany({
where: { published: true },
orderBy: { createdAt: "desc" },
include: {
translations: {
where: { locale },
select: { title: true, description: true },
},
},
});
const localized = projects.map((p) => {
const tr = p.translations?.[0];
const { translations: _translations, ...rest } = p;
return {
...rest,
title: tr?.title ?? p.title,
description: tr?.description ?? p.description,
};
});
return <ProjectsPageClient projects={localized} locale={locale} />;
}