import ArtworkMetaCard from "@/components/artworks/ArtworkMetaCard"; import { ContextBackButton } from "@/components/artworks/ContextBackButton"; import { prisma } from "@/lib/prisma"; import { cn } from "@/lib/utils"; import Image from "next/image"; import Link from "next/link"; export default async function SingleArtworkPage({ params }: { params: { id: string }; searchParams: Record; }) { const { id } = await params; const artwork = await prisma.artwork.findUnique({ where: { id, }, include: { file: true, gallery: true, metadata: true, albums: true, categories: true, colors: { include: { color: true } }, tags: true, variants: true } }) if (!artwork) return
Artwork with this ID could not be found
const { width, height } = artwork.variants.find((v) => v.type === "resized") ?? { width: 0, height: 0 } const colors = artwork.colors?.map((c) => c.color?.hex).filter((hex): hex is string => Boolean(hex)) ?? [] const gradientColors = colors.length ? colors.join(", ") : "rgba(0,0,0,0.1), rgba(0,0,0,0.03)" return (
{artwork.name ? (

{artwork.name}

) : null}
{artwork.altText
); }