diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..8f00030 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,5 @@ +# Default ignored files +/shelf/ +/workspace.xml +# GitHub Copilot persisted chat sessions +/copilot/chatSessions diff --git a/.idea/aws.xml b/.idea/aws.xml new file mode 100644 index 0000000..03f1bb6 --- /dev/null +++ b/.idea/aws.xml @@ -0,0 +1,17 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4444b22 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..5355e1d --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/neroshitron.iml b/.idea/neroshitron.iml new file mode 100644 index 0000000..dc88000 --- /dev/null +++ b/.idea/neroshitron.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/gallery/page.tsx b/app/gallery/page.tsx index f1c6255..b6c6fc5 100644 --- a/app/gallery/page.tsx +++ b/app/gallery/page.tsx @@ -2,17 +2,24 @@ import { createClient } from "@/utils/supabase/client"; import React, { useState, useEffect } from 'react'; import Search from "@/components/neroshitron/search"; +import Gallery from "@/components/neroshitron/gallery"; function PageComponent() { + const [selectedGallery, setSelectedGallery] = useState(null); const supabase = createClient(); const getData = async () => { } - + useEffect(() => { getData(); - }, []); + console.log(selectedGallery) + }, [selectedGallery]); + + const closeGallery = () => { + setSelectedGallery(null); + } return ( @@ -24,7 +31,31 @@ function PageComponent() { alt="Background" /> - + {setSelectedGallery(gallery)}}/> + + {selectedGallery!=null ? ( + <> + {/* + This is the modal for holding the gallery + */} + + + ) : null} ); } diff --git a/components/neroshitron/galleries.tsx b/components/neroshitron/galleries.tsx index 72ef1e6..8875888 100644 --- a/components/neroshitron/galleries.tsx +++ b/components/neroshitron/galleries.tsx @@ -6,9 +6,10 @@ interface TagProps { nsfw: boolean; tags: string[]; search: string; + gallerySelected: (gallery: string) => void; } -const Galleries = ({ nsfw, tags, search }:TagProps) => { +const Galleries = ({ nsfw, tags, search, gallerySelected }:TagProps) => { const [galleries, setGalleries] = useState([]); const [nsfwState, setNsfwState] = useState(nsfw); @@ -19,6 +20,7 @@ const Galleries = ({ nsfw, tags, search }:TagProps) => { const selectGallery = (gallery: string) => { setSelectedGallery(gallery); + gallerySelected(gallery); }; console.log(tags) diff --git a/components/neroshitron/search.tsx b/components/neroshitron/search.tsx index 20976cd..5ca3379 100644 --- a/components/neroshitron/search.tsx +++ b/components/neroshitron/search.tsx @@ -3,12 +3,15 @@ import React, { useState, useEffect } from 'react'; import SearchInput from '@/components/neroshitron/search_input'; import Galleries from './galleries'; -interface SearchProps { } +interface SearchProps { + gallerySelected: (gallery: string) => void; +} -const Search = ({ }:SearchProps) => { +const Search = ({gallerySelected }:SearchProps) => { const [tags, setTags] = useState([]); const [search, setSearch] = useState(''); const [nsfw, setNsfw] = useState(false); + const [gallery, setGallery] = useState(null); const getData = async () => { } @@ -22,18 +25,27 @@ const Search = ({ }:SearchProps) => { useEffect(() => { getData(); }, [tags]); + useEffect(() => { + getData(); + if(gallery!=null) + gallerySelected(gallery); + }, [gallery]); +//TRY TESTING WITH THIS REMOVED! + + + + useEffect(() => { getData(); }, []); return ( <> - + {setGallery(gallery)}} key={search+"-"+tags.length+"-"+nsfw} search={search} nsfw={nsfw} tags={tags} />
{setSearch(search)}} nsfwChanged={(nsfw)=>{setNsfw(nsfw)}} tagsChanged={(tags)=>{setTags(tags);}} />
-
); diff --git a/components/neroshitron/search_input.tsx b/components/neroshitron/search_input.tsx index 1ba173f..84c5943 100644 --- a/components/neroshitron/search_input.tsx +++ b/components/neroshitron/search_input.tsx @@ -34,11 +34,6 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged}: SearchInputProp } } - const getData = async () => { - const tagsResponse = await fetch(`/api/galleries/tags`); - const tagsData = await tagsResponse.json(); - setTags(tagsData); - } useEffect(() => { searchChanged(search); }, [search]); @@ -49,7 +44,6 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged}: SearchInputProp nsfwChanged(nsfw); }, [nsfw]); useEffect(() => { - getData(); }, []); @@ -101,7 +95,7 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged}: SearchInputProp {(selectingTags) && - { updateTags(newTags) }} selectedTagsInput={selectedTags} ref={tagSelectorRef} />} + { updateTags(newTags) }} selectedTagsInput={selectedTags} ref={tagSelectorRef} />} ); }; diff --git a/components/neroshitron/tag_pill.tsx b/components/neroshitron/tag_pill.tsx index 16265a7..f61f5d4 100644 --- a/components/neroshitron/tag_pill.tsx +++ b/components/neroshitron/tag_pill.tsx @@ -7,7 +7,8 @@ const Tag = ({ onTagClicked, selected, tag, }:TagProps) => { return (