mirror of
https://github.com/Radiquum/AniX.git
synced 2025-04-07 00:34:41 +00:00
feat: add more search where filters
This commit is contained in:
parent
f4d4d6a773
commit
c9a1ec5324
1 changed files with 57 additions and 39 deletions
|
@ -70,6 +70,15 @@ const TagMapping = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const WhereMapping = {
|
||||||
|
releases: "Релизах",
|
||||||
|
list: "Списках",
|
||||||
|
history: "Истории",
|
||||||
|
favorites: "Избранном",
|
||||||
|
collections: "Коллекциях",
|
||||||
|
profiles: "Профилях",
|
||||||
|
};
|
||||||
|
|
||||||
export function SearchPage() {
|
export function SearchPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
|
@ -318,8 +327,13 @@ const FiltersModal = (props: {
|
||||||
Params.delete("list");
|
Params.delete("list");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!["profiles", "collections"].includes(where)) {
|
||||||
Params.set("searchBy", searchBy);
|
Params.set("searchBy", searchBy);
|
||||||
props.setSearchBy(searchBy);
|
props.setSearchBy(searchBy);
|
||||||
|
} else {
|
||||||
|
Params.delete("searchBy");
|
||||||
|
props.setSearchBy("name");
|
||||||
|
}
|
||||||
|
|
||||||
const url = new URL(`/search?${Params.toString()}`, window.location.origin);
|
const url = new URL(`/search?${Params.toString()}`, window.location.origin);
|
||||||
router.push(url.toString());
|
router.push(url.toString());
|
||||||
|
@ -332,27 +346,27 @@ const FiltersModal = (props: {
|
||||||
<div className="my-4">
|
<div className="my-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<p className="font-bold dark:text-white">Искать в</p>
|
<p className="font-bold dark:text-white">Искать в</p>
|
||||||
<Button.Group>
|
<Dropdown label={WhereMapping[where]} color="blue">
|
||||||
<Button
|
{Object.keys(WhereMapping).map((item) => {
|
||||||
color={where == "releases" ? "blue" : "gray"}
|
if (
|
||||||
onClick={() => setWhere("releases")}
|
["list", "history", "collections", "favorites"].includes(
|
||||||
|
item
|
||||||
|
) &&
|
||||||
|
!props.isAuth
|
||||||
|
) {
|
||||||
|
return <></>;
|
||||||
|
} else {
|
||||||
|
return (
|
||||||
|
<Dropdown.Item
|
||||||
|
onClick={() => setWhere(item)}
|
||||||
|
key={`where--${item}`}
|
||||||
>
|
>
|
||||||
Релизах
|
{WhereMapping[item]}
|
||||||
</Button>
|
</Dropdown.Item>
|
||||||
<Button
|
);
|
||||||
color={where == "list" ? "blue" : "gray"}
|
}
|
||||||
disabled={!props.isAuth}
|
})}
|
||||||
onClick={() => setWhere("list")}
|
</Dropdown>
|
||||||
>
|
|
||||||
Списках
|
|
||||||
</Button>
|
|
||||||
{/* <Button
|
|
||||||
color={false ? "blue" : "gray"}
|
|
||||||
// onClick={() => setMode("dark")}
|
|
||||||
>
|
|
||||||
Пользователях
|
|
||||||
</Button> */}
|
|
||||||
</Button.Group>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{props.isAuth &&
|
{props.isAuth &&
|
||||||
|
@ -378,6 +392,7 @@ const FiltersModal = (props: {
|
||||||
) : (
|
) : (
|
||||||
""
|
""
|
||||||
)}
|
)}
|
||||||
|
{!["profiles", "collections"].includes(where) ? (
|
||||||
<div className="my-4">
|
<div className="my-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<p className="font-bold dark:text-white">Искать по</p>
|
<p className="font-bold dark:text-white">Искать по</p>
|
||||||
|
@ -395,6 +410,9 @@ const FiltersModal = (props: {
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
<Modal.Footer>
|
<Modal.Footer>
|
||||||
<div className="flex justify-end w-full gap-2">
|
<div className="flex justify-end w-full gap-2">
|
||||||
|
|
Loading…
Add table
Reference in a new issue