From 4a287dac639156be436ec1f29d80d213fa428c87 Mon Sep 17 00:00:00 2001 From: Faye Date: Fri, 24 Nov 2023 16:55:03 +0100 Subject: [PATCH] .. is everything fixed? --- .../user/[uniqueId]/gallery/page.client.jsx | 601 +++++++++--------- 1 file changed, 283 insertions(+), 318 deletions(-) diff --git a/src/app/user/[uniqueId]/gallery/page.client.jsx b/src/app/user/[uniqueId]/gallery/page.client.jsx index 18f09c45..a2023bde 100644 --- a/src/app/user/[uniqueId]/gallery/page.client.jsx +++ b/src/app/user/[uniqueId]/gallery/page.client.jsx @@ -25,7 +25,7 @@ export default function FetchGallery() { const [isHovered, setIsHovered] = useState(false); const [currentPage, setCurrentPage] = useState(1); const [totalPages, setTotalPages] = useState(1); - + const username = typeof window !== "undefined" ? window.location.pathname.split("/")[2] : ""; @@ -33,6 +33,10 @@ export default function FetchGallery() { return `${process.env.NEXT_PUBLIC_API_URL}/v1/storage/buckets/655ca6663497d9472539/files/${galleryId}/preview?project=6557c1a8b6c2739b3ecf&width=400`; }; + const getAvatarImageUrl = (galleryId) => { + return `${process.env.NEXT_PUBLIC_API_URL}/v1/storage/buckets/655842922bac16a94a25/files/${galleryId}/preview?project=6557c1a8b6c2739b3ecf&width=100&output=webp&quality=75`; + }; + useEffect(() => { fetch( `/api/user/getUserProfileFilter?queries[]=equal("profileurl","${username}")`, @@ -42,6 +46,7 @@ export default function FetchGallery() { ) .then((response) => response.json()) .then((data) => { + console.log(data); setUserData(data.documents[0]); // Access the first (and only) object in the array setUserId(data.documents[0].$id); }) @@ -56,12 +61,9 @@ export default function FetchGallery() { const fetchUserData = async () => { try { - const response = await fetch( - `/api/user/getUserDataSelf`, - { - method: "GET", - } - ); + const response = await fetch(`/api/user/getUserDataSelf`, { + method: "GET", + }); const data = await response.json(); setEnableNsfw(data[0].enablensfw); @@ -113,324 +115,287 @@ export default function FetchGallery() { return ( <>
- {isLoading ? ( - error ? ( -

- Error: {error.message} -

- ) : ( - - ) - ) : ( - <> - {userMe ? ( // Check if userData exists - <> -
- +
+ + + + + );