Files
app.fellies.art/src/app/(normal)/galleries/[gallerySlug]/[albumSlug]/page.tsx
2025-07-01 22:19:48 +02:00

43 lines
1.2 KiB
TypeScript

import ImageList from "@/components/lists/ImageList";
import prisma from "@/lib/prisma";
export default async function GalleryPage({ params }: { params: { gallerySlug: string, albumSlug: string } }) {
const { gallerySlug, albumSlug } = await params;
const gallery = await prisma.gallery.findUnique({
where: { slug: gallerySlug },
select: { id: true },
});
if (!gallery) {
throw new Error("Gallery not found");
}
const album = await prisma.album.findUnique({
where: {
galleryId_slug: {
galleryId: gallery.id,
slug: albumSlug,
},
},
include: {
images: { include: { colors: { include: { color: true } } } },
}
})
return (
<div className="max-w-7xl mx-auto px-4 py-12 space-y-12">
{album && (
<>
<section className="text-center space-y-4">
<h1 className="text-4xl font-bold tracking-tight">Album: {album.name}</h1>
<p className="text-lg text-muted-foreground">
{album.description}
</p>
</section>
<ImageList images={album.images} gallerySlug={gallerySlug} albumSlug={albumSlug} />
</>
)}
</div>
);
}