diff --git a/app/gallery/page_old.tsx b/app/gallery/page_old.tsx index 510cdcf..4a56149 100644 --- a/app/gallery/page_old.tsx +++ b/app/gallery/page_old.tsx @@ -1,131 +1,126 @@ -"use client"; -import { createClient } from "@/utils/supabase/client"; -import { redirect } from "next/navigation"; -import GalleryThumbnail from "@/components/ui/gallery_thumbnail"; +// "use client"; +// import { createClient } from "@/utils/supabase/client"; +// import React, { useState, useEffect } from 'react'; +// import { User } from "@supabase/supabase-js"; +// import Search from "@/components/ui/search"; +// function PageComponent() { -import React, { useState, useEffect } from 'react'; -import { User } from "@supabase/supabase-js"; -import Gallery from "@/components/ui/gallery"; -import Search from "@/components/ui/search"; +// const supabase = createClient(); -function PageComponent() { +// const [showNSFW, setShowNSFW] = useState(true); +// const [randomIds, setRandomIds] = useState([]); // replace any with your gallery type +// const [isOpen, setIsOpen] = useState(false); +// const [galleries, setGalleries] = useState([]); // replace any with your gallery type +// const [user, setUser] = useState(null); +// const [loading, setLoading] = useState(true); +// const [selectedGallery, setSelectedGallery] = useState(null); +// const [search, setSearch] = useState(''); +// const [galleryColumns, setColumns] = useState(0); +// const [selectedTags, setSelectedTags] = useState([]); +// const generateRandomString = function (length: number) { +// let result = ''; +// let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; +// let charactersLength = characters.length; +// for (let i = 0; i < length; i++) { +// result += characters.charAt(Math.floor(Math.random() * charactersLength)); +// } +// return result; +// } - const supabase = createClient(); +// const selectGallery = (gallery: string, columns: number) => { +// setRandomIds([generateRandomString(3), generateRandomString(3), generateRandomString(3), generateRandomString(3)]); +// setSelectedGallery(gallery); +// setColumns(columns); +// setIsOpen(true); +// }; - const [showNSFW, setShowNSFW] = useState(true); - const [randomIds, setRandomIds] = useState([]); // replace any with your gallery type - const [isOpen, setIsOpen] = useState(false); - const [galleries, setGalleries] = useState([]); // replace any with your gallery type - const [user, setUser] = useState(null); - const [loading, setLoading] = useState(true); - const [selectedGallery, setSelectedGallery] = useState(null); - const [search, setSearch] = useState(''); - const [galleryColumns, setColumns] = useState(0); - const [selectedTags, setSelectedTags] = useState([]); - const generateRandomString = function (length: number) { - let result = ''; - let characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; - let charactersLength = characters.length; - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)); - } - return result; - } +// const closeGallery = () => { +// setSelectedGallery(null); +// setColumns(0); +// setIsOpen(false); +// } - const selectGallery = (gallery: string, columns: number) => { - setRandomIds([generateRandomString(3), generateRandomString(3), generateRandomString(3), generateRandomString(3)]); - setSelectedGallery(gallery); - setColumns(columns); - setIsOpen(true); - }; - - const closeGallery = () => { - setSelectedGallery(null); - setColumns(0); - setIsOpen(false); - } - - const getData = async () => { - let { data: { user } } = await supabase.auth.getUser(); - const galleriesResponse = await fetch(`/api/galleries?search=` + search + '&nsfw=' + showNSFW, { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ tags: selectedTags }) - }); - const galleriesData = await galleriesResponse.json(); - setGalleries(galleriesData); - setUser(user); - setLoading(false); - } +// const getData = async () => { +// let { data: { user } } = await supabase.auth.getUser(); +// const galleriesResponse = await fetch(`/api/galleries?search=` + search + '&nsfw=' + showNSFW, { +// method: 'POST', +// headers: { +// 'Content-Type': 'application/json' +// }, +// body: JSON.stringify({ tags: selectedTags }) +// }); +// const galleriesData = await galleriesResponse.json(); +// setGalleries(galleriesData); +// setUser(user); +// setLoading(false); +// } - useEffect(() => { - getData(); - }, [selectedTags, search, showNSFW]); +// useEffect(() => { +// getData(); +// }, [selectedTags, search, showNSFW]); - return ( -
-
- Background -
+// return ( +//
+//
+// Background +//
- +// - {/* - These are the thumbnails for the gallery below the search bar - */} -
- {galleries && galleries.map((gallery, index) => ( -
- -
- ))} -
- {isOpen ? ( - <> - {/* - This is the modal for holding the gallery - */} - - - ) : null} -
- ); -} +// {/* +// These are the thumbnails for the gallery below the search bar +// */} +//
+// {galleries && galleries.map((gallery, index) => ( +//
+// +//
+// ))} +//
+// {isOpen ? ( +// <> +// {/* +// This is the modal for holding the gallery +// */} +// +// +// ) : null} +//
+// ); +// } -export default PageComponent; \ No newline at end of file +// export default PageComponent; \ No newline at end of file diff --git a/components/neroshitron/galleries.tsx b/components/neroshitron/galleries.tsx index 78c87a4..72ef1e6 100644 --- a/components/neroshitron/galleries.tsx +++ b/components/neroshitron/galleries.tsx @@ -41,7 +41,8 @@ const Galleries = ({ nsfw, tags, search }:TagProps) => { return (
- {galleries && galleries.map((gallery, index) => ( + + {galleries && galleries.map((gallery:any, index) => ( 0)? (
-
- {props.tagsInput.map((tag: any) => ( +
+ {props.tagsInput.map((tag: any) => ( (tagSearch === '' || tag.name.toLowerCase().includes(tagSearch.toLowerCase())) && // Updated condition handleTag(tag)} /> ))}