25 lines
1006 B
TypeScript
25 lines
1006 B
TypeScript
import ListGalleries from "@/components/galleries/list/ListGalleries";
|
|
import prisma from "@/lib/prisma";
|
|
import { PlusCircleIcon } from "lucide-react";
|
|
import Link from "next/link";
|
|
|
|
export default async function GalleriesPage() {
|
|
const galleries = await prisma.gallery.findMany({
|
|
orderBy: { createdAt: "asc" },
|
|
include: {
|
|
albums: { select: { id: true } }
|
|
}
|
|
});
|
|
|
|
return (
|
|
<div>
|
|
<div className="flex gap-4 justify-between">
|
|
<h1 className="text-2xl font-bold mb-4">Galleries</h1>
|
|
<Link href="/galleries/new" className="flex gap-2 items-center cursor-pointer bg-primary hover:bg-primary/90 text-primary-foreground px-4 py-2 rounded">
|
|
<PlusCircleIcon className="h-[1.2rem] w-[1.2rem] scale-100 rotate-0 transition-all text-primary-foreground" /> Add new gallery
|
|
</Link>
|
|
</div>
|
|
{galleries.length > 0 ? <ListGalleries galleries={galleries} /> : <p className="text-muted-foreground italic">No galleries found.</p>}
|
|
</div>
|
|
);
|
|
} |