diff --git a/app/pages/Search.tsx b/app/pages/Search.tsx index b357ffe..2d17f0b 100644 --- a/app/pages/Search.tsx +++ b/app/pages/Search.tsx @@ -70,6 +70,15 @@ const TagMapping = { }, }; +const WhereMapping = { + releases: "Релизах", + list: "Списках", + history: "Истории", + favorites: "Избранном", + collections: "Коллекциях", + profiles: "Профилях", +}; + export function SearchPage() { const router = useRouter(); const searchParams = useSearchParams(); @@ -318,8 +327,13 @@ const FiltersModal = (props: { Params.delete("list"); } - Params.set("searchBy", searchBy); - props.setSearchBy(searchBy); + if (!["profiles", "collections"].includes(where)) { + Params.set("searchBy", searchBy); + props.setSearchBy(searchBy); + } else { + Params.delete("searchBy"); + props.setSearchBy("name"); + } const url = new URL(`/search?${Params.toString()}`, window.location.origin); router.push(url.toString()); @@ -332,27 +346,27 @@ const FiltersModal = (props: {

Искать в

- - - - {/* */} - + + {Object.keys(WhereMapping).map((item) => { + if ( + ["list", "history", "collections", "favorites"].includes( + item + ) && + !props.isAuth + ) { + return <>; + } else { + return ( + setWhere(item)} + key={`where--${item}`} + > + {WhereMapping[item]} + + ); + } + })} +
{props.isAuth && @@ -378,23 +392,27 @@ const FiltersModal = (props: { ) : ( "" )} -
-
-

Искать по

- - {Object.keys(TagMapping).map((item) => { - return ( - setSearchBy(item)} - key={`tag--${item}`} - > - {TagMapping[item].name} - - ); - })} - + {!["profiles", "collections"].includes(where) ? ( +
+
+

Искать по

+ + {Object.keys(TagMapping).map((item) => { + return ( + setSearchBy(item)} + key={`tag--${item}`} + > + {TagMapping[item].name} + + ); + })} + +
-
+ ) : ( + "" + )}