mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
revert(catalog): disable catalog filters temporarily, they don't perform well with api
This commit is contained in:
@@ -45,29 +45,37 @@ const useCatalogFiltersStore = create(
|
||||
},
|
||||
filter: undefined,
|
||||
updateFilter: () => {
|
||||
const filteredCids = new Set<string>();
|
||||
// const filteredCids = new Set<string>();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ const CatalogFilters = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<span className={`${styles.filtersButton} button`} onClick={() => setShowModal(true)}>
|
||||
<span className={`${styles.filtersButton} button`} onClick={() => setShowModal(false)} style={{ cursor: 'not-allowed' }}>
|
||||
{t('filters')}
|
||||
</span>
|
||||
{showModal && <FiltersModal closeModal={closeModal} />}
|
||||
|
||||
Reference in New Issue
Block a user