From f7cef69b5bc906da214a716fc6a3ddfeafbf74e2 Mon Sep 17 00:00:00 2001 From: Damien Ostler Date: Mon, 27 May 2024 08:19:53 -0400 Subject: [PATCH] fix: tiles no longer get cut off --- app/api/galleries/[id]/images/route.ts | 1 - app/api/galleries/[id]/thumbnail/route.ts | 5 ++++- app/gallery/page.tsx | 3 ++- components/ui/gallery.tsx | 2 -- components/ui/gallery_thumbnail.tsx | 21 +++++++++++++++------ 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/app/api/galleries/[id]/images/route.ts b/app/api/galleries/[id]/images/route.ts index 941a19f..1e6bf93 100644 --- a/app/api/galleries/[id]/images/route.ts +++ b/app/api/galleries/[id]/images/route.ts @@ -71,7 +71,6 @@ export async function GET( } break; default: - blobBuffer = await blurImage(blobBuffer) break; } const contentType = file.name.endsWith('.png') ? 'image/png' : 'image/jpeg'; diff --git a/app/api/galleries/[id]/thumbnail/route.ts b/app/api/galleries/[id]/thumbnail/route.ts index 47042b3..e6e9d63 100644 --- a/app/api/galleries/[id]/thumbnail/route.ts +++ b/app/api/galleries/[id]/thumbnail/route.ts @@ -62,7 +62,10 @@ const galleryId= params.id // 312 } break; default: - + if(gallery.nsfw){ + blobBuffer = await blurImage(blobBuffer); + + } break; } const dataUrl = `data:${contentType};base64,${blobBuffer.toString('base64')}`; diff --git a/app/gallery/page.tsx b/app/gallery/page.tsx index b8e8387..767b4c2 100644 --- a/app/gallery/page.tsx +++ b/app/gallery/page.tsx @@ -118,7 +118,7 @@ function PageComponent() {
-
+
{galleries && galleries.map((gallery, index) => ( ))}
diff --git a/components/ui/gallery.tsx b/components/ui/gallery.tsx index 15c898d..6a3a739 100644 --- a/components/ui/gallery.tsx +++ b/components/ui/gallery.tsx @@ -141,10 +141,8 @@ const Gallery = ({ id, columns, closeMenu }: GalleryProps) => { const panZoomRef = useRef(null); const resetPanZoom = (event: any) => { - console.log(event.target.id) if (panZoomRef.current && event.target.id != "image-container") { panZoomRef.current.autoCenter(); - console.log("POGER") } }; diff --git a/components/ui/gallery_thumbnail.tsx b/components/ui/gallery_thumbnail.tsx index 1cf459d..663e7ad 100644 --- a/components/ui/gallery_thumbnail.tsx +++ b/components/ui/gallery_thumbnail.tsx @@ -6,15 +6,16 @@ interface GalleryThumbnailProps { onSelect: (id: string, columns: number) => void; title: string; subscription: string; + nsfw: boolean; } -const GalleryThumbnail = ({ id, columns, onSelect, title, subscription }: GalleryThumbnailProps) => { +const GalleryThumbnail = ({ id, columns, onSelect, title,nsfw, subscription }: GalleryThumbnailProps) => { const [galleryId, setGalleryId] = useState(id); const [thumbnailUrl, setThumbnailUrl] = useState(''); const [isLoading, setIsLoading] = useState(true); const [galleryCollumns, setColumns] = useState(columns); const [imageCount, setImageCount] = useState(0); - + const [nsfwState, setNsfw] = useState(nsfw); const openGallery = () => { onSelect(galleryId, galleryCollumns); }; @@ -36,7 +37,7 @@ const GalleryThumbnail = ({ id, columns, onSelect, title, subscription }: Galler return (
-
+
{!isLoading && ( <> -
+

{title}

+
+
@@ -69,9 +72,15 @@ const GalleryThumbnail = ({ id, columns, onSelect, title, subscription }: Galler
{imageCount} pictures in this gallery.
+ {(nsfwState) && ( +
+ NSFW + +
+ )} {subscription === "Free" && ( -
- Free +
Free +
This is free for everyone.