Skip to content

Commit

Permalink
fix: allow multiple source type selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala committed Aug 23, 2024
1 parent 4b6d3ed commit 9b40bab
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 34 deletions.
26 changes: 4 additions & 22 deletions src/components/filter/FilterDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,15 @@ function FilterDropdown({
};

const showSelectedNdiType = () => {
if (!showNdiType) {
setOnlyShowNdiSources(true);
setOnlyShowBmdSources(false);
setOnlyShowSrtSources(false);
} else {
setOnlyShowNdiSources(false);
}
setOnlyShowNdiSources(!showNdiType);
};

const showSelectedSrtType = () => {
if (!showSrtType) {
setOnlyShowSrtSources(true);
setOnlyShowNdiSources(false);
setOnlyShowBmdSources(false);
} else {
setOnlyShowSrtSources(false);
}
setOnlyShowSrtSources(!showSrtType);
};

const showSelectedBmdType = () => {
if (!showBmdType) {
setOnlyShowBmdSources(true);
setOnlyShowNdiSources(false);
setOnlyShowSrtSources(false);
} else {
setOnlyShowBmdSources(false);
}
setOnlyShowBmdSources(!showBmdType);
};

const deleteTag = (value: string) => {
Expand Down Expand Up @@ -320,7 +302,7 @@ function FilterDropdown({
className="ml-2 mt-1 text-left text-zinc-300"
htmlFor="showSelectedCheckbox"
>
SDI/HTML
SDI/HDMI
</label>
</div>
</div>
Expand Down
25 changes: 13 additions & 12 deletions src/components/filter/FilterOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,24 @@ function FilterOptions({ onFilteredSources }: FilterOptionsProps) {
const correspondingResource = resources.find(
(resource) => resource.name === source.ingest_source_name
);

if (correspondingResource) {
let shouldDelete = false;
if (
const isNdiSelected =
onlyShowNdiSources &&
correspondingResource.type.toUpperCase() !== 'NDI'
) {
shouldDelete = true;
}
if (
correspondingResource.type.toUpperCase() === 'NDI';
const isBmdSelected =
onlyShowBmdSources &&
correspondingResource.type.toUpperCase() !== 'BMD'
) {
shouldDelete = true;
}
if (
correspondingResource.type.toUpperCase() === 'BMD';
const isSrtSelected =
onlyShowSrtSources &&
correspondingResource.type.toUpperCase() !== 'SRT'
correspondingResource.type.toUpperCase() === 'SRT';

if (
(onlyShowNdiSources || onlyShowBmdSources || onlyShowSrtSources) &&
!isNdiSelected &&
!isBmdSelected &&
!isSrtSelected
) {
shouldDelete = true;
}
Expand Down

0 comments on commit 9b40bab

Please sign in to comment.