Skip to content

Commit

Permalink
Merge pull request #186 from TogetherCrew/fix/deselect-overview-boxes
Browse files Browse the repository at this point in the history
add ability to deselect
  • Loading branch information
mehdi-torabiv authored Sep 14, 2023
2 parents 2ab1815 + 1d6d1c7 commit 5440938
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 11 deletions.
6 changes: 5 additions & 1 deletion src/components/pages/statistics/ActiveMembersComposition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,11 @@ export default function ActiveMembersComposition({

if (existingFilterIndex !== -1) {
// If it exists, replace the existing filter's label with the new label
existingFilters[existingFilterIndex].label = label;
if (existingFilters[existingFilterIndex].label !== label) {
existingFilters[existingFilterIndex].label = label;
} else {
existingFilters.splice(existingFilterIndex, 1); // remove the item
}
} else {
// If it doesn't exist, add the new filter to the array
existingFilters.push(newFilter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ export default function DisengagedMembersComposition({

if (existingFilterIndex !== -1) {
// If it exists, replace the existing filter's label with the new label
existingFilters[existingFilterIndex].label = label;
if (existingFilters[existingFilterIndex].label !== label) {
existingFilters[existingFilterIndex].label = label;
} else {
existingFilters.splice(existingFilterIndex, 1); // remove the item
}
} else {
// If it doesn't exist, add the new filter to the array
existingFilters.push(newFilter);
Expand Down
6 changes: 5 additions & 1 deletion src/components/pages/statistics/Onboarding.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ export default function Onboarding({

if (existingFilterIndex !== -1) {
// If it exists, replace the existing filter's label with the new label
existingFilters[existingFilterIndex].label = label;
if (existingFilters[existingFilterIndex].label !== label) {
existingFilters[existingFilterIndex].label = label;
} else {
existingFilters.splice(existingFilterIndex, 1); // remove the item
}
} else {
// If it doesn't exist, add the new filter to the array
existingFilters.push(newFilter);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ export default function ActiveMemberBreakdown() {
const matchedValue = matchedOption.value;
handleActivityOptionSelectionChange([matchedValue]);
}
} else {
handleActivityOptionSelectionChange(
options.map((option) => option.value)
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,7 @@ const options: IActivityCompositionOptions[] = [
];

export default function DisengagedMembersCompositionBreakdown() {
const {
getDisengagedMembersCompositionTable,
isDisengagedMembersCompositionBreakdownLoading,
} = useAppStore();
const { getDisengagedMembersCompositionTable } = useAppStore();

const tableTopRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -130,6 +127,10 @@ export default function DisengagedMembersCompositionBreakdown() {
const matchedValue = matchedOption.value;
handleActivityOptionSelectionChange([matchedValue]);
}
} else {
handleActivityOptionSelectionChange(
options.map((option) => option.value)
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@ const options: IActivityCompositionOptions[] = [
];

export default function OnboardingMembersBreakdown() {
const {
getOnboardingMemberCompositionTable,
isOnboardingMembersBreakdownLoading,
} = useAppStore();
const { getOnboardingMemberCompositionTable } = useAppStore();

const tableTopRef = useRef<HTMLDivElement>(null);

Expand Down Expand Up @@ -118,6 +115,10 @@ export default function OnboardingMembersBreakdown() {
const matchedValue = matchedOption.value;
handleActivityOptionSelectionChange([matchedValue]);
}
} else {
handleActivityOptionSelectionChange(
options.map((option) => option.value)
);
}
}
}
Expand Down

0 comments on commit 5440938

Please sign in to comment.