mirror of
https://github.com/D4M13N-D3V/neroshitron.git
synced 2025-03-14 10:05:04 +00:00
fix: tag format
This commit is contained in:
parent
96aeca6242
commit
e6a81a3bdf
@ -33,14 +33,16 @@ function PageComponent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const createTag = async () => {
|
const createTag = async () => {
|
||||||
|
let formattedTag = newTagName.toLowerCase().replace(" ", "_");
|
||||||
const tagsResponse = await fetch(`/api/galleries/tags`, {
|
const tagsResponse = await fetch(`/api/galleries/tags`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
body: JSON.stringify({ tag: newTagName })
|
body: JSON.stringify({ tag: formattedTag })
|
||||||
});
|
});
|
||||||
const tagsData = await tagsResponse.json();
|
const tagsData = await tagsResponse.json();
|
||||||
|
setNewTagName('');
|
||||||
getData();
|
getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,7 +60,7 @@ function PageComponent() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getData();
|
getData();
|
||||||
}, [tagsState]);
|
}, [tagsState, newTagName]);
|
||||||
|
|
||||||
const data = [
|
const data = [
|
||||||
{ id: 1, name: "Item 1", imageCount: 5, tier: "Tier 1" },
|
{ id: 1, name: "Item 1", imageCount: 5, tier: "Tier 1" },
|
||||||
@ -70,7 +72,7 @@ function PageComponent() {
|
|||||||
<div className="w-full h-1/2 text-white lg:flex justify-center items-center animate-in">
|
<div className="w-full h-1/2 text-white lg:flex justify-center items-center animate-in">
|
||||||
<div className="w-full lg:w-1/3 rounded-md bg-primary opacity-90 p-12 m-1 mt-32 shadow-lg backdrop-blur">
|
<div className="w-full lg:w-1/3 rounded-md bg-primary opacity-90 p-12 m-1 mt-32 shadow-lg backdrop-blur">
|
||||||
<div className="w-full flex">
|
<div className="w-full flex">
|
||||||
<input type="text" onChange={(e)=>{setNewTagName(e.target.value)}} className="hover:scale-105 focus:scale-105 mb-8 mr-2 rounded-md bg-info-bright p-2 w-1/2 text-black shadow-lg" placeholder="Tag Name" />
|
<input value={newTagName} type="text" onChange={(e)=>{setNewTagName(e.target.value)}} className="hover:scale-105 focus:scale-105 mb-8 mr-2 rounded-md bg-info-bright p-2 w-1/2 text-black shadow-lg" placeholder="Tag Name" />
|
||||||
<button onClick={createTag} className="hover:scale-95 ml-2 shadow-lg w-1/2 h-10 text-center bg-success hover:bg-success-light text-white font-bold rounded flex items-center justify-center">
|
<button onClick={createTag} className="hover:scale-95 ml-2 shadow-lg w-1/2 h-10 text-center bg-success hover:bg-success-light text-white font-bold rounded flex items-center justify-center">
|
||||||
Create New Tag
|
Create New Tag
|
||||||
</button>
|
</button>
|
||||||
|
@ -16,10 +16,13 @@ interface SearchInputProps {
|
|||||||
|
|
||||||
const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnabled, placeholderTags, startingTags }: SearchInputProps) => {
|
const SearchInput = ({ tagsChanged, searchChanged, nsfwChanged, nsfwButtonEnabled, placeholderTags, startingTags }: SearchInputProps) => {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const [tagSearch, setTagSearch] = useState<string>('');
|
const [tagSearch, setTagSearch] = useState<string>('');
|
||||||
const [nsfw, setNsfw] = useState<boolean>(false);
|
const [nsfw, setNsfw] = useState<boolean>(false);
|
||||||
const [selectedTags, setSelectedTags] = useState<string[]>(startingTags ?? []);
|
const [selectedTags, setSelectedTags] = useState<string[]>(startingTags ?? []);
|
||||||
const [selectedTagsInput, setSelectedTagsInput] = useState<Option[]>(startingTags?.map((tag) => ({ value: tag, label: tag })) || []);
|
const [selectedTagsInput, setSelectedTagsInput] = useState<Option[]>([...placeholderTags, ...(startingTags ?? []).map((tag) => ({ value: tag, label: tag }))]);
|
||||||
const [selectingTags, setSelectingTags] = useState<boolean>(false);
|
const [selectingTags, setSelectingTags] = useState<boolean>(false);
|
||||||
const tagSelectorRef = React.useRef(null);
|
const tagSelectorRef = React.useRef(null);
|
||||||
const [tags, setTags] = useState<any[]>([]);
|
const [tags, setTags] = useState<any[]>([]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user