From cadf4160587712cdec5d63212c53f8dd2d698c41 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Tue, 17 Sep 2024 17:04:38 +0200 Subject: [PATCH] revert(catalog): disable catalog filters temporarily, they don't perform well with api --- src/stores/use-catalog-filters-store.ts | 38 +++++++++++-------- .../catalog-filters/catalog-filters.tsx | 2 +- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/stores/use-catalog-filters-store.ts b/src/stores/use-catalog-filters-store.ts index 67db2ab9..c2b1fde4 100644 --- a/src/stores/use-catalog-filters-store.ts +++ b/src/stores/use-catalog-filters-store.ts @@ -45,29 +45,37 @@ const useCatalogFiltersStore = create( }, filter: undefined, updateFilter: () => { - const filteredCids = new Set(); + // const filteredCids = new Set(); set((state) => ({ filter: (comment: Comment) => { - const { showTextOnlyThreads, filterItems } = state; + const { + showTextOnlyThreads, + // filterItems + } = state; const hasThumbnail = getHasThumbnail(getCommentMediaInfo(comment), comment?.link); - const title = comment?.title?.toLowerCase() || ''; - const content = comment?.content?.toLowerCase() || ''; + // const title = comment?.title?.toLowerCase() || ''; + // const content = comment?.content?.toLowerCase() || ''; - const matchesFilterItems = filterItems - .filter((item) => item.enabled) - .some((item) => { - const text = item.text.toLowerCase(); - return title.includes(text) || content.includes(text); - }); + // const matchesFilterItems = filterItems + // .filter((item) => item.enabled) + // .some((item) => { + // const text = item.text.toLowerCase(); + // return title.includes(text) || content.includes(text); + // }); const shouldShow = showTextOnlyThreads || hasThumbnail; - if (!shouldShow || matchesFilterItems) { - if (matchesFilterItems && !filteredCids.has(comment.cid)) { - filteredCids.add(comment.cid); - set((state) => ({ filteredCount: state.filteredCount + 1 })); - } + if ( + !shouldShow + // || matchesFilterItems + ) { + // if ( + // matchesFilterItems && + // !filteredCids.has(comment.cid)) { + // filteredCids.add(comment.cid); + // set((state) => ({ filteredCount: state.filteredCount + 1 })); + // } return false; } diff --git a/src/views/catalog/catalog-filters/catalog-filters.tsx b/src/views/catalog/catalog-filters/catalog-filters.tsx index 39a53f61..e104f51e 100644 --- a/src/views/catalog/catalog-filters/catalog-filters.tsx +++ b/src/views/catalog/catalog-filters/catalog-filters.tsx @@ -131,7 +131,7 @@ const CatalogFilters = () => { return ( <> - setShowModal(true)}> + setShowModal(false)} style={{ cursor: 'not-allowed' }}> {t('filters')} {showModal && }