Fixes
This commit is contained in:
@ -2,7 +2,6 @@ import ArtistInfoBox from "@/components/images/ArtistInfoBox";
|
||||
import GlowingImageWithToggle from "@/components/images/GlowingImageWithToggle";
|
||||
import ImageMetadataBox from "@/components/images/ImageMetadataBox";
|
||||
import prisma from "@/lib/prisma";
|
||||
import Link from "next/link";
|
||||
|
||||
export default async function ImagePage({ params }: { params: { gallerySlug: string, albumSlug: string, imageId: string } }) {
|
||||
const { imageId } = await params;
|
||||
@ -38,15 +37,15 @@ export default async function ImagePage({ params }: { params: { gallerySlug: str
|
||||
</div>
|
||||
|
||||
{resizedVariant &&
|
||||
<Link href={`/raw/${image.id}`} passHref>
|
||||
<GlowingImageWithToggle
|
||||
alt={image.imageName}
|
||||
variant={resizedVariant}
|
||||
colors={image.colors}
|
||||
src={`/api/image/${resizedVariant.s3Key}`}
|
||||
nsfw={image.nsfw}
|
||||
/>
|
||||
</Link>
|
||||
<GlowingImageWithToggle
|
||||
alt={image.imageName}
|
||||
variant={resizedVariant}
|
||||
colors={image.colors}
|
||||
src={`/api/image/${resizedVariant.s3Key}`}
|
||||
nsfw={image.nsfw}
|
||||
imageId={image.id}
|
||||
/>
|
||||
|
||||
}
|
||||
<section className="py-8 flex flex-col gap-4">
|
||||
{image.artist && <ArtistInfoBox artist={image.artist} />}
|
||||
|
@ -5,7 +5,7 @@ import NextImage from "next/image";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
export default async function RawImagePage({ params }: { params: { imageId: string } }) {
|
||||
const { imageId } = params;
|
||||
const { imageId } = await params;
|
||||
|
||||
const image = await prisma.image.findUnique({
|
||||
where: { id: imageId },
|
||||
|
@ -1,6 +1,7 @@
|
||||
"use client"
|
||||
|
||||
import { Color, ImageColor, ImageVariant } from "@/generated/prisma";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { Label } from "../ui/label";
|
||||
import { Switch } from "../ui/switch";
|
||||
@ -12,22 +13,26 @@ type Props = {
|
||||
alt: string;
|
||||
src: string;
|
||||
nsfw: boolean;
|
||||
imageId: string;
|
||||
}
|
||||
|
||||
export default function GlowingImageWithToggle({ variant, colors, alt, src, nsfw }: Props) {
|
||||
export default function GlowingImageWithToggle({ variant, colors, alt, src, nsfw, imageId }: Props) {
|
||||
const [animate, setAnimate] = useState(true);
|
||||
const [revealed, setRevealed] = useState(!nsfw)
|
||||
|
||||
return (
|
||||
<div className="relative w-full max-w-fit">
|
||||
<GlowingImageBorder
|
||||
alt={alt}
|
||||
variant={variant}
|
||||
colors={colors}
|
||||
src={src}
|
||||
animate={animate}
|
||||
revealed={revealed}
|
||||
/>
|
||||
|
||||
<Link href={`/raw/${imageId}`} passHref>
|
||||
<GlowingImageBorder
|
||||
alt={alt}
|
||||
variant={variant}
|
||||
colors={colors}
|
||||
src={src}
|
||||
animate={animate}
|
||||
revealed={revealed}
|
||||
/>
|
||||
</Link>
|
||||
|
||||
<div className="flex flex-col items-center gap-4 pt-8">
|
||||
<div className="flex items-center gap-2">
|
||||
@ -36,14 +41,16 @@ export default function GlowingImageWithToggle({ variant, colors, alt, src, nsfw
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{nsfw && (
|
||||
<div className="flex flex-col items-center gap-4 pt-8">
|
||||
<div className="flex items-center gap-2">
|
||||
<Switch id="animate" checked={revealed} onCheckedChange={setRevealed} />
|
||||
<Label htmlFor="animate">Reveal NSFW</Label>
|
||||
{
|
||||
nsfw && (
|
||||
<div className="flex flex-col items-center gap-4 pt-8">
|
||||
<div className="flex items-center gap-2">
|
||||
<Switch id="animate" checked={revealed} onCheckedChange={setRevealed} />
|
||||
<Label htmlFor="animate">Reveal NSFW</Label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</div >
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user