From e09020ed0a737ffa0c48face14f8f3311f028d7e Mon Sep 17 00:00:00 2001 From: Saelmala Date: Fri, 6 Sep 2024 11:29:25 +0200 Subject: [PATCH 1/2] fix: bug fixes on filter --- src/components/filter/FilterDropdown.tsx | 56 +++++++--- src/components/filter/FilterOptions.tsx | 131 +++++++++++------------ src/components/inventory/Inventory.tsx | 2 +- 3 files changed, 105 insertions(+), 84 deletions(-) diff --git a/src/components/filter/FilterDropdown.tsx b/src/components/filter/FilterDropdown.tsx index 85c9eb2..5e76583 100644 --- a/src/components/filter/FilterDropdown.tsx +++ b/src/components/filter/FilterDropdown.tsx @@ -15,6 +15,7 @@ function FilterDropdown({ showNdiType, showBmdType, showSrtType, + showMediaSourceGeneratorType, setIsTypeHidden, setIsLocationHidden, setSelectedTags, @@ -22,6 +23,7 @@ function FilterDropdown({ setOnlyShowNdiSources: setOnlyShowNdiSources, setOnlyShowBmdSources: setOnlyShowBmdSources, setOnlyShowSrtSources: setOnlyShowSrtSources, + setOnlyShowMediaSourceGeneratorSources, handleSorting }: { close: () => void; @@ -35,6 +37,7 @@ function FilterDropdown({ showNdiType: boolean; showSrtType: boolean; showBmdType: boolean; + showMediaSourceGeneratorType: boolean; setIsTypeHidden: React.Dispatch>; setIsLocationHidden: React.Dispatch>; setOnlyShowActiveSources: React.Dispatch>; @@ -42,6 +45,9 @@ function FilterDropdown({ setOnlyShowNdiSources: React.Dispatch>; setOnlyShowBmdSources: React.Dispatch>; setOnlyShowSrtSources: React.Dispatch>; + setOnlyShowMediaSourceGeneratorSources: React.Dispatch< + React.SetStateAction + >; handleSorting: (reversedOrder: boolean) => void; }) { const t = useTranslate(); @@ -75,22 +81,26 @@ function FilterDropdown({ setIsTypeHidden(true); }; - const showSelectedConfigSources = () => { + const toggleConfigSources = () => { setOnlyShowConfigSources(!showConfigSources); }; - const showSelectedNdiType = () => { + const toggleNdiType = () => { setOnlyShowNdiSources(!showNdiType); }; - const showSelectedSrtType = () => { + const toggleSrtType = () => { setOnlyShowSrtSources(!showSrtType); }; - const showSelectedBmdType = () => { + const toggleBmdType = () => { setOnlyShowBmdSources(!showBmdType); }; + const toggleMediaSourceGeneratorType = () => { + setOnlyShowMediaSourceGeneratorSources(!showMediaSourceGeneratorType); + }; + const deleteTag = (value: string) => { const temp = selectedTags; temp.delete(value); @@ -148,10 +158,11 @@ function FilterDropdown({ const handleClear = () => { setSelectedTags(new Set()); - setOnlyShowConfigSources(false); - setOnlyShowBmdSources(false); - setOnlyShowNdiSources(false); - setOnlyShowSrtSources(false); + setOnlyShowConfigSources(true); + setOnlyShowBmdSources(true); + setOnlyShowNdiSources(true); + setOnlyShowSrtSources(true); + setOnlyShowMediaSourceGeneratorSources(false); }; const typesSearch = (event: ChangeEvent) => { @@ -259,7 +270,7 @@ function FilterDropdown({ })} +
+ + +
diff --git a/src/components/inventory/Inventory.tsx b/src/components/inventory/Inventory.tsx index 7603616..8a46c43 100644 --- a/src/components/inventory/Inventory.tsx +++ b/src/components/inventory/Inventory.tsx @@ -42,7 +42,7 @@ export default function Inventory() { filteredSources: Map ): React.ReactNode { return Array.from( - filteredSources.size > 0 ? filteredSources.values() : sources.values() + filteredSources.size >= 0 ? filteredSources.values() : sources.values() ).map((source, index) => { if (source.status !== 'purge') { return ( From 665641ca0af3824001346282e6c59e9e7f145e7b Mon Sep 17 00:00:00 2001 From: Saelmala Date: Fri, 6 Sep 2024 11:43:44 +0200 Subject: [PATCH 2/2] fix: test fail --- src/components/filter/FilterOptions.tsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/components/filter/FilterOptions.tsx b/src/components/filter/FilterOptions.tsx index cc4d216..23b2bd7 100644 --- a/src/components/filter/FilterOptions.tsx +++ b/src/components/filter/FilterOptions.tsx @@ -30,8 +30,6 @@ function FilterOptions({ onFilteredSources }: FilterOptionsProps) { Map >(new Map()); - useEffect(() => {}, [showMediaSourceGeneratorType]); - useEffect(() => { const tempSet = new Map(sources);