From bef53cadcefc094649f440a95a01ef72bc2a69b0 Mon Sep 17 00:00:00 2001 From: Damien Ostler Date: Sat, 1 Jun 2024 16:29:58 -0400 Subject: [PATCH 1/2] fix: gallery not opening (#5) --- .gitignore | 4 ++++ components/neroshitron/galleries.tsx | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0ca5675..00bf3d3 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,7 @@ yarn-error.log* /supabase/volumes/db/data /supabase/volumes/storage supabase.zip +.idea/workspace.xml +.idea/copilot/chatSessions/xd.lck +.idea/copilot/chatSessions/blobs/version +.idea/copilot/chatSessions/00000000000.xd 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) From 41c90c2a58d70cea18f2425de0285dd105a58459 Mon Sep 17 00:00:00 2001 From: Damien Ostler Date: Sat, 1 Jun 2024 16:30:05 -0400 Subject: [PATCH 2/2] fix: clicking tag breaks tag ui (#6) --- .idea/.gitignore | 5 ++++ .idea/aws.xml | 17 +++++++++++ .idea/encodings.xml | 4 +++ .idea/misc.xml | 6 ++++ .idea/modules.xml | 8 +++++ .idea/neroshitron.iml | 11 +++++++ .idea/vcs.xml | 6 ++++ app/gallery/page.tsx | 37 +++++++++++++++++++++-- components/neroshitron/search.tsx | 20 ++++++++++--- components/neroshitron/search_input.tsx | 8 +---- components/neroshitron/tag_pill.tsx | 3 +- components/neroshitron/tag_selector.tsx | 40 ++++++++++++++++--------- 12 files changed, 136 insertions(+), 29 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/aws.xml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/neroshitron.iml create mode 100644 .idea/vcs.xml 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/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 (