From be0731cfbac0c75c13c69267f6f8a1e620440f26 Mon Sep 17 00:00:00 2001 From: Radiquum Date: Sat, 23 Aug 2025 00:09:56 +0500 Subject: [PATCH] feat: all collections search --- app/api/config.ts | 1 + .../CollectionLink/CollectionLink.tsx | 10 ++++++---- app/pages/Search.tsx | 17 +++++++++++++---- public/changelog/3.8.0.md | 4 ++++ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/app/api/config.ts b/app/api/config.ts index 9f3a2ba..316d19e 100644 --- a/app/api/config.ts +++ b/app/api/config.ts @@ -58,6 +58,7 @@ export const ENDPOINTS = { profileFavorites: `${API_PREFIX}/search/favorites`, profiles: `${API_PREFIX}/search/profiles`, releases: `${API_PREFIX}/search/releases`, + collections: `${API_PREFIX}/search/collections`, }, statistic: { addHistory: `${API_PREFIX}/history/add`, diff --git a/app/components/CollectionLink/CollectionLink.tsx b/app/components/CollectionLink/CollectionLink.tsx index 61371e1..aee2010 100644 --- a/app/components/CollectionLink/CollectionLink.tsx +++ b/app/components/CollectionLink/CollectionLink.tsx @@ -28,10 +28,12 @@ export const CollectionLink = (props: any) => { icon_name="material-symbols--favorite" name_2={props.favorites_count} /> - + {props.comment_count && ( + + )} {props.is_private && (
diff --git a/app/pages/Search.tsx b/app/pages/Search.tsx index b06d000..c5ee065 100644 --- a/app/pages/Search.tsx +++ b/app/pages/Search.tsx @@ -61,8 +61,13 @@ const whereMapping = [ auth: true, }, { - id: "collections", - label: "Коллекциях", + id: "collections_all", + label: "Всех Коллекциях", + auth: false, + }, + { + id: "collections_fav", + label: "Своих Коллекциях", auth: true, }, ]; @@ -179,6 +184,7 @@ export function SearchPage() { url.searchParams.set("query", query); url.searchParams.set("params", JSON.stringify(params)); router.replace(url.toString()); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [query]); const getKey = (pageIndex: number, previousPageData: any) => { @@ -214,7 +220,10 @@ export function SearchPage() { case "favorites": url = `${ENDPOINTS.search.profileFavorites}/${pageIndex}`; break; - case "collections": + case "collections_all": + url = `${ENDPOINTS.search.collections}/${pageIndex}`; + break; + case "collections_fav": url = `${ENDPOINTS.search.profileFavoriteCollection}/${pageIndex}`; break; } @@ -385,7 +394,7 @@ export function SearchPage() { content.length > 0 ? params.where == "profiles" ? - : params.where == "collections" ? + : ["collections_all", "collections_fav"].includes(params.where) ? : :
diff --git a/public/changelog/3.8.0.md b/public/changelog/3.8.0.md index a2c50b9..949fde6 100644 --- a/public/changelog/3.8.0.md +++ b/public/changelog/3.8.0.md @@ -1,5 +1,9 @@ # 3.8.0 +## Добавлено + +- Поиск среди всех коллекций + ## Изменено - Фильтры на странице поиска были перемещены рядом с полем ввода