From 6e4fa104c0fcc9a2b82b88e1650b31c8ee60fe9a Mon Sep 17 00:00:00 2001 From: enes Date: Mon, 28 Oct 2024 14:49:36 +0100 Subject: [PATCH] fix(search): add mods source filter fn Closes #77 --- src/pages/search.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/pages/search.tsx b/src/pages/search.tsx index 9fe49d8..ca31395 100644 --- a/src/pages/search.tsx +++ b/src/pages/search.tsx @@ -337,8 +337,15 @@ const ModsResult = ({ tag.toLowerCase().includes(lowerCaseSearchTerm) ) > -1 - return mods.filter(filterFn) - }, [mods, searchTerm]) + const filterSourceFn = (mod: ModDetails) => { + if (filterOptions.source === window.location.host) { + return mod.rTag === filterOptions.source + } + return true + } + + return mods.filter(filterFn).filter(filterSourceFn) + }, [filterOptions.source, mods, searchTerm]) const filteredModList = useFilteredMods( filteredMods,