38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import RawCloseButton from "@/components/artworks/RawCloseButton";
|
|
import { prisma } from "@/lib/prisma";
|
|
import NextImage from "next/image";
|
|
import { notFound } from "next/navigation";
|
|
|
|
export default async function RawArtworkPage({ params }: { params: { artworkId: string } }) {
|
|
const { artworkId } = await params;
|
|
|
|
const artwork = await prisma.artwork.findUnique({
|
|
where: { id: artworkId },
|
|
include: {
|
|
file: true,
|
|
variants: true
|
|
},
|
|
});
|
|
|
|
if (!artwork) return notFound();
|
|
const variant = artwork.variants.find(v => v.type === "modified");
|
|
if (!variant) return notFound();
|
|
const targetHref = `/artworks/single/${artwork.id}`;
|
|
|
|
return (
|
|
<div
|
|
className="fixed inset-0 z-50 flex items-center justify-center"
|
|
// style={backgroundStyle}
|
|
>
|
|
<RawCloseButton targetHref={targetHref} />
|
|
<NextImage
|
|
src={`/api/image/modified/${artwork.file.fileKey}.webp`}
|
|
alt={artwork.altText || artwork.name}
|
|
width={variant.width}
|
|
height={variant.height}
|
|
className="object-contain rounded-lg max-h-[calc(100vh-2rem)] max-w-[calc(100vw-2rem)]"
|
|
/>
|
|
</div>
|
|
|
|
);
|
|
} |