mirror of
https://github.com/D4M13N-D3V/neroshitron.git
synced 2025-06-16 05:09:17 +00:00
chore: formatting
This commit is contained in:
parent
97f2a31951
commit
9b5c3d44c5
@ -1,126 +0,0 @@
|
|||||||
// "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() {
|
|
||||||
|
|
||||||
// const supabase = createClient();
|
|
||||||
|
|
||||||
// const [showNSFW, setShowNSFW] = useState<boolean>(true);
|
|
||||||
// const [randomIds, setRandomIds] = useState<string[]>([]); // replace any with your gallery type
|
|
||||||
// const [isOpen, setIsOpen] = useState<boolean>(false);
|
|
||||||
// const [galleries, setGalleries] = useState<any[]>([]); // replace any with your gallery type
|
|
||||||
// const [user, setUser] = useState<User | null>(null);
|
|
||||||
// const [loading, setLoading] = useState<boolean>(true);
|
|
||||||
// const [selectedGallery, setSelectedGallery] = useState<string | null>(null);
|
|
||||||
// const [search, setSearch] = useState<string>('');
|
|
||||||
// const [galleryColumns, setColumns] = useState<number>(0);
|
|
||||||
// const [selectedTags, setSelectedTags] = useState<string[]>([]);
|
|
||||||
// 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 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);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// useEffect(() => {
|
|
||||||
// getData();
|
|
||||||
// }, [selectedTags, search, showNSFW]);
|
|
||||||
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// <div>
|
|
||||||
// <div className="fixed w-full h-full overflow-hidden z-0 animate-fade-left animate-fade-left animate-once animate-duration-[2000ms] animate-normal animate-fill-forwards">
|
|
||||||
// <img
|
|
||||||
// src="gallery_girl.png"
|
|
||||||
// className="float-right object-cover h-screen w-full lg:w-5/6 xl:w-3/6 opacity-50 overflow-hidden"
|
|
||||||
// alt="Background"
|
|
||||||
// />
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// <Search
|
|
||||||
// />
|
|
||||||
|
|
||||||
|
|
||||||
// {/*
|
|
||||||
// These are the thumbnails for the gallery below the search bar
|
|
||||||
// */}
|
|
||||||
// <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-y-60 gap-x-5 h-full mb-96 animate-in">
|
|
||||||
// {galleries && galleries.map((gallery, index) => (
|
|
||||||
// <div className="mx-auto">
|
|
||||||
// <GalleryThumbnail
|
|
||||||
// key={gallery.name + " " + showNSFW}
|
|
||||||
// id={gallery.name}
|
|
||||||
// title={gallery.name}
|
|
||||||
// tags={gallery.tags}
|
|
||||||
// columns={gallery.columns}
|
|
||||||
// showNsfw={showNSFW}
|
|
||||||
// subscription={gallery.tier as string}
|
|
||||||
// onSelect={selectGallery}
|
|
||||||
// nsfw={gallery.nsfw}
|
|
||||||
// ></GalleryThumbnail>
|
|
||||||
// </div>
|
|
||||||
// ))}
|
|
||||||
// </div>
|
|
||||||
// {isOpen ? (
|
|
||||||
// <>
|
|
||||||
// {/*
|
|
||||||
// This is the modal for holding the gallery
|
|
||||||
// */}
|
|
||||||
// <div
|
|
||||||
// className={`fixed inset-0 transition-opacity z-30 ${isOpen ? 'animate-in' : 'fade-out'
|
|
||||||
// }`}
|
|
||||||
// aria-hidden="true"
|
|
||||||
// >
|
|
||||||
// <div
|
|
||||||
// className="absolute inset-0 bg-neroshi-blue-900 opacity-70 z-30"
|
|
||||||
// onClick={() => setIsOpen(false)}
|
|
||||||
// ></div>
|
|
||||||
// <div className="absolute inset-0 overflow-y-auto overflow-x-hidden no-scrollbar pt-2 w-full p-20 z-30">
|
|
||||||
// <Gallery
|
|
||||||
// id={selectedGallery as string}
|
|
||||||
// columns={galleryColumns}
|
|
||||||
// closeMenu={() => closeGallery()}
|
|
||||||
// ></Gallery>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// </>
|
|
||||||
// ) : null}
|
|
||||||
// </div>
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
|
|
||||||
// export default PageComponent;
|
|
@ -24,8 +24,7 @@ export default async function AuthButton() {
|
|||||||
const currentPage = heads.get('x-path')
|
const currentPage = heads.get('x-path')
|
||||||
|
|
||||||
const getGravatarUrl = () => {
|
const getGravatarUrl = () => {
|
||||||
if(user==null)
|
if (user == null) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let email = user.email;
|
let email = user.email;
|
||||||
|
@ -77,8 +77,8 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged}: SearchInputProp
|
|||||||
)
|
)
|
||||||
: (
|
: (
|
||||||
<>
|
<>
|
||||||
<Select isMultiple isSearchable isClearable searchInputPlaceholder='Start typing to search tags...' options={tagOptions} placeholder="Start typing to search tags..."
|
<Select isMultiple isSearchable isClearable searchInputPlaceholder='Start typing to search tags...'
|
||||||
|
options={tagOptions}
|
||||||
onChange={(value: Option | Option[] | null) => {
|
onChange={(value: Option | Option[] | null) => {
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
setSelectedTags([]);
|
setSelectedTags([]);
|
||||||
@ -92,22 +92,8 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged}: SearchInputProp
|
|||||||
setSelectedTagsInput([value])
|
setSelectedTagsInput([value])
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
|
||||||
value={selectedTagsInput} primaryColor={'neroshi-blue'} />
|
value={selectedTagsInput} primaryColor={'neroshi-blue'} />
|
||||||
<span className="flex items-center rounded rounded-l-none border-0 px-3 font-bold text-grey-100">
|
<span className="flex items-center rounded rounded-l-none border-0 px-3 font-bold text-grey-100">
|
||||||
{/* <div className="relative">
|
|
||||||
<button key="tags" data-tip={selectedTags.join(',')} onClick={()=>{openTags()}} type="button" className={`bg-neroshi-blue-900 hover:bg-neroshi-blue-800 text-lg text-white font-bold py-3 px-6 rounded ${selectedTags.length == 0 ? 'animate-pulse animate-infinite animate-ease-out' : 'animate-in'}`}>
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="size-6">
|
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" d="M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z" />
|
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" d="M6 6h.008v.008H6V6Z" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
<span className="absolute top-8 left-14 inline-block w-6 h-6 </svg>text-xs bg-pink-800 text-white rounded-full flex items-center justify-center">
|
|
||||||
{selectedTags.length}
|
|
||||||
</span>
|
|
||||||
</div> */}
|
|
||||||
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
onClick={() => { setNsfw(!nsfw) }}
|
onClick={() => { setNsfw(!nsfw) }}
|
||||||
type="button"
|
type="button"
|
||||||
@ -118,7 +104,6 @@ const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged}: SearchInputProp
|
|||||||
</button>
|
</button>
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,15 +45,6 @@ const TagSelector = forwardRef<TagSelectorProps, {tagSearch: string, selectedTag
|
|||||||
getData();
|
getData();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const generateRandomString = () => {
|
|
||||||
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
||||||
let result = '';
|
|
||||||
for (let i = 0; i < 10; i++) {
|
|
||||||
result += characters.charAt(Math.floor(Math.random() * characters.length));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
console.log(tags.length)
|
|
||||||
return (
|
return (
|
||||||
|
|
||||||
<div className="flex md:w-full pt-4 justify-center items-center">
|
<div className="flex md:w-full pt-4 justify-center items-center">
|
||||||
|
@ -1,96 +0,0 @@
|
|||||||
"use client;"
|
|
||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
import TagSelector from './tag_selector';
|
|
||||||
|
|
||||||
interface SearchProps { }
|
|
||||||
|
|
||||||
const Search = ({ }:SearchProps) => {
|
|
||||||
const [nsfw, setNsfw] = useState<boolean>(false);
|
|
||||||
const [tags, setTags] = useState<any[]>([]);
|
|
||||||
const [search, setSearch] = useState<string>('');
|
|
||||||
const [selectedTags, setSelectedTagsState] = useState<string[]>([]);
|
|
||||||
const [selectingTags, setSelectingTags] = useState<boolean>(false);
|
|
||||||
|
|
||||||
const getNsfw = () => {
|
|
||||||
return nsfw;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getTags = () => {
|
|
||||||
return tags;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSearch = () => {
|
|
||||||
return search;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getSelectedTags = () => {
|
|
||||||
return selectedTags;
|
|
||||||
};
|
|
||||||
|
|
||||||
const getData = async () => {
|
|
||||||
const tagsResponse = await fetch(`/api/galleries/tags`);
|
|
||||||
const tagsData = await tagsResponse.json();
|
|
||||||
setTags(tagsData);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getData();
|
|
||||||
}, [selectingTags]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<section className="flex items-center w-full p-8 pt-20 opacity-90 animate-jump-in animate-once animate-duration-500">
|
|
||||||
{(tags.length > 0) ? (
|
|
||||||
<div className="container mx-auto py-8">
|
|
||||||
<div className="relative w-full mx-auto">
|
|
||||||
<input
|
|
||||||
className="animate-in animate-delay-[2000ms] w-full text-neroshi-blue-950 h-16 px-3 rounded mb-8 focus:outline-none focus:shadow-outline text-xl px-8 shadow-lg"
|
|
||||||
type="search"
|
|
||||||
placeholder="Search by title..."
|
|
||||||
onChange={(e) => setSearch(e.target.value)}
|
|
||||||
/>
|
|
||||||
<div className="absolute right-0 top-0 h-full mr-2 flex items-center">
|
|
||||||
<label htmlFor="toggleNSFW" className="text-neroshi-blue-950 animate-in animate-delay-[2000ms] animate-ease-out">
|
|
||||||
Censor NSFW
|
|
||||||
<input
|
|
||||||
id="toggleNSFW"
|
|
||||||
type="checkbox"
|
|
||||||
onChange={(e) => setNsfw(e.target.checked)}
|
|
||||||
className="form-checkbox h-5 w-5 text-neroshi-blue-950 ml-2"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<nav className="pt-6 grid grid-cols-3 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10 gap-4 justify-items-center">
|
|
||||||
{tags.map((tag, index) => (
|
|
||||||
<a
|
|
||||||
key={index}
|
|
||||||
className={`w-full rounded-lg no-underline text-white py-3 px-4 font-medium text-center animate-jump-in animate-once animate-duration-500 animate-ease-out ${selectedTags.includes(tag.name) ? 'bg-neroshi-blue-950 hover:bg-neroshi-blue-900' : 'bg-neroshi-blue-800 hover:bg-neroshi-blue-700'
|
|
||||||
}`}
|
|
||||||
href="#"
|
|
||||||
>
|
|
||||||
{tag.name}
|
|
||||||
</a>
|
|
||||||
))}
|
|
||||||
<a
|
|
||||||
key={"select-tags"}
|
|
||||||
className={`w-full rounded-lg no-underline text-white py-3 px-4 font-medium text-center animate-jump-in animate-once animate-duration-500 animate-ease-out bg-pink-800 hover:bg-pink-700`}
|
|
||||||
href="#"
|
|
||||||
onClick={() => setSelectingTags(true)}
|
|
||||||
>
|
|
||||||
Select Tags : {selectingTags}
|
|
||||||
</a>
|
|
||||||
</nav>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="animate-pulse bg-neroshi-blue-950 rounded-3xl w-full p-8 mt-10 h-48"></div>
|
|
||||||
)}
|
|
||||||
{(selectingTags) ??(
|
|
||||||
<TagSelector/>
|
|
||||||
)}
|
|
||||||
</section>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Search;
|
|
@ -1,27 +0,0 @@
|
|||||||
"use client;"
|
|
||||||
import React, { useState, useEffect } from 'react';
|
|
||||||
|
|
||||||
interface SearchProps { }
|
|
||||||
|
|
||||||
const TagSelector = ({ }:SearchProps) => {
|
|
||||||
|
|
||||||
|
|
||||||
const getData = async () => {
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
getData();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className={`fixed inset-0 transition-opacity z-30 animate-in`} aria-hidden="true" >
|
|
||||||
<div className="absolute inset-0 bg-neroshi-blue-900 opacity-70 z-30">
|
|
||||||
</div>
|
|
||||||
<div className="absolute inset-0 overflow-y-auto overflow-x-hidden no-scrollbar pt-2 w-full p-20 z-30">
|
|
||||||
Test
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default TagSelector;
|
|
Loading…
x
Reference in New Issue
Block a user