feat: pass nsfw prop to GalleryFullscreen and update image nsfw check

This commit is contained in:
2025-11-28 19:35:31 +08:00
parent 1d78207004
commit a0fb279b29

View File

@@ -78,6 +78,7 @@ export default function Gallery({
<GalleryFullscreen <GalleryFullscreen
dialogRef={dialogRef} dialogRef={dialogRef}
images={images} images={images}
nsfw={nsfw}
currentIndex={currentIndex} currentIndex={currentIndex}
direction={direction} direction={direction}
goToPrevious={goToPrevious} goToPrevious={goToPrevious}
@@ -124,7 +125,7 @@ export default function Gallery({
> >
<GalleryImage <GalleryImage
src={network.getImageUrl(images[currentIndex])} src={network.getImageUrl(images[currentIndex])}
nfsw={nsfw.includes(currentIndex)} nfsw={nsfw.includes(images[currentIndex])}
/> />
</motion.div> </motion.div>
</AnimatePresence> </AnimatePresence>
@@ -188,6 +189,7 @@ export default function Gallery({
function GalleryFullscreen({ function GalleryFullscreen({
dialogRef, dialogRef,
images, images,
nsfw,
currentIndex, currentIndex,
direction, direction,
goToPrevious, goToPrevious,
@@ -197,6 +199,7 @@ function GalleryFullscreen({
}: { }: {
dialogRef: React.RefObject<HTMLDialogElement | null>; dialogRef: React.RefObject<HTMLDialogElement | null>;
images: number[]; images: number[];
nsfw: number[];
currentIndex: number; currentIndex: number;
direction: number; direction: number;
goToPrevious: () => void; goToPrevious: () => void;
@@ -316,7 +319,7 @@ function GalleryFullscreen({
<img <img
src={network.getImageUrl(images[currentIndex])} src={network.getImageUrl(images[currentIndex])}
alt="" alt=""
className="w-full h-full object-contain rounded-xl" className="w-full h-full object-contain rounded-xl select-none"
/> />
</motion.div> </motion.div>
</AnimatePresence> </AnimatePresence>
@@ -361,7 +364,7 @@ function GalleryFullscreen({
className={`flex-shrink-0 w-16 h-16 rounded-lg overflow-hidden transition-all ${ className={`flex-shrink-0 w-16 h-16 rounded-lg overflow-hidden transition-all ${
index === currentIndex index === currentIndex
? "ring-2 ring-primary scale-110 " ? "ring-2 ring-primary scale-110 "
: "opacity-60 hover:opacity-100" : `${nsfw.includes(imageId) ? "blur-sm hover:blur-none" : "opacity-60 hover:opacity-100"}`
}`} }`}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -373,7 +376,7 @@ function GalleryFullscreen({
<img <img
src={network.getResampledImageUrl(imageId)} src={network.getResampledImageUrl(imageId)}
alt={`Thumbnail ${index + 1}`} alt={`Thumbnail ${index + 1}`}
className="w-full h-full object-cover" className={`w-full h-full object-cover select-none`}
/> />
</button> </button>
))} ))}