import ArtworkMetaCard from "@/components/artworks/ArtworkMetaCard"; import ArtworkTimelapseViewer from "@/components/artworks/ArtworkTimelapseViewer"; import { ContextBackButton } from "@/components/artworks/ContextBackButton"; import NsfwConsentDialog from "@/components/nsfw/NsfwConsentDialog"; import NsfwImage from "@/components/nsfw/NsfwImage"; import NsfwLink from "@/components/nsfw/NsfwLink"; import { Button } from "@/components/ui/button"; import { prisma } from "@/lib/prisma"; import { cn } from "@/lib/utils"; import { PlayCircle } from "lucide-react"; 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, timelapse: { where: { enabled: 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.timelapse?.enabled ? (
Watch timelapse } />
) : null}
); }