From cc739e3359c1f794ce179a8cd8ea416a5cf7f856 Mon Sep 17 00:00:00 2001 From: Michael Chung Date: Thu, 1 May 2025 15:40:51 -0400 Subject: [PATCH] Ok so I fixed the gallery modal it shouldn't use the cdn anymore. since the json object already has the url in the response. I am surprised this even worked. --- .../gallery-modal/src/lib/gallery-modal.tsx | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/frontend/libs/components/gallery-modal/src/lib/gallery-modal.tsx b/frontend/libs/components/gallery-modal/src/lib/gallery-modal.tsx index 096110b6ba..7f76f33461 100644 --- a/frontend/libs/components/gallery-modal/src/lib/gallery-modal.tsx +++ b/frontend/libs/components/gallery-modal/src/lib/gallery-modal.tsx @@ -8,7 +8,6 @@ import { CloseButton } from "@storyteller/ui-close-button"; import { LoadingSpinner } from "@storyteller/ui-loading-spinner"; import React, { useState, useEffect, useCallback, useMemo } from "react"; import { - GetCdnOrigin, FilterMediaClasses, GalleryModalApi, UsersApi, @@ -63,7 +62,7 @@ export const GalleryModal = React.memo( const [isLightboxVisible, setIsLightboxVisible] = useState(false); const [failedImageUrls] = useState>(new Set()); const [username, setUsername] = useState(""); - const cdnOrigin = GetCdnOrigin(); + const imageUrl = lightboxImage?.fullImage || ""; const api = useMemo(() => new GalleryModalApi(), []); const usersApi = useMemo(() => new UsersApi(), []); @@ -107,16 +106,6 @@ export const GalleryModal = React.memo( [failedImageUrls] ); - const getImageUrl = useCallback( - (path: string | undefined | null) => { - if (!path) return null; - const normalizedPath = path.startsWith("/") ? path : `/${path}`; - const url = `${cdnOrigin}${normalizedPath}`; - return failedImageUrls.has(url) ? null : url; - }, - [cdnOrigin, failedImageUrls] - ); - useEffect(() => { const getUsername = async () => { const session = await usersApi.GetSession(); @@ -142,8 +131,8 @@ export const GalleryModal = React.memo( const newItems = response.data.map((item: any) => ({ id: item.token, label: item.maybe_title || "Image Generation", - thumbnail: getImageUrl(item.public_bucket_path), - fullImage: getImageUrl(item.public_bucket_path), + thumbnail: item.thumbnail, + fullImage: item.fullImage, createdAt: item.created_at, })); setGroupedItems(groupItemsByDate(newItems));