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,
|
filter: undefined,
|
||||||
updateFilter: () => {
|
updateFilter: () => {
|
||||||
const filteredCids = new Set<string>();
|
// const filteredCids = new Set<string>();
|
||||||
set((state) => ({
|
set((state) => ({
|
||||||
filter: (comment: Comment) => {
|
filter: (comment: Comment) => {
|
||||||
const { showTextOnlyThreads, filterItems } = state;
|
const {
|
||||||
|
showTextOnlyThreads,
|
||||||
|
// filterItems
|
||||||
|
} = state;
|
||||||
|
|
||||||
const hasThumbnail = getHasThumbnail(getCommentMediaInfo(comment), comment?.link);
|
const hasThumbnail = getHasThumbnail(getCommentMediaInfo(comment), comment?.link);
|
||||||
const title = comment?.title?.toLowerCase() || '';
|
// const title = comment?.title?.toLowerCase() || '';
|
||||||
const content = comment?.content?.toLowerCase() || '';
|
// const content = comment?.content?.toLowerCase() || '';
|
||||||
|
|
||||||
const matchesFilterItems = filterItems
|
// const matchesFilterItems = filterItems
|
||||||
.filter((item) => item.enabled)
|
// .filter((item) => item.enabled)
|
||||||
.some((item) => {
|
// .some((item) => {
|
||||||
const text = item.text.toLowerCase();
|
// const text = item.text.toLowerCase();
|
||||||
return title.includes(text) || content.includes(text);
|
// return title.includes(text) || content.includes(text);
|
||||||
});
|
// });
|
||||||
|
|
||||||
const shouldShow = showTextOnlyThreads || hasThumbnail;
|
const shouldShow = showTextOnlyThreads || hasThumbnail;
|
||||||
|
|
||||||
if (!shouldShow || matchesFilterItems) {
|
if (
|
||||||
if (matchesFilterItems && !filteredCids.has(comment.cid)) {
|
!shouldShow
|
||||||
filteredCids.add(comment.cid);
|
// || matchesFilterItems
|
||||||
set((state) => ({ filteredCount: state.filteredCount + 1 }));
|
) {
|
||||||
}
|
// if (
|
||||||
|
// matchesFilterItems &&
|
||||||
|
// !filteredCids.has(comment.cid)) {
|
||||||
|
// filteredCids.add(comment.cid);
|
||||||
|
// set((state) => ({ filteredCount: state.filteredCount + 1 }));
|
||||||
|
// }
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ const CatalogFilters = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<span className={`${styles.filtersButton} button`} onClick={() => setShowModal(true)}>
|
<span className={`${styles.filtersButton} button`} onClick={() => setShowModal(false)} style={{ cursor: 'not-allowed' }}>
|
||||||
{t('filters')}
|
{t('filters')}
|
||||||
</span>
|
</span>
|
||||||
{showModal && <FiltersModal closeModal={closeModal} />}
|
{showModal && <FiltersModal closeModal={closeModal} />}
|
||||||
|
|||||||
Reference in New Issue
Block a user