Skip to content

Commit

Permalink
feat: Listen for single filter changes for overall filter
Browse files Browse the repository at this point in the history
  • Loading branch information
karelianpie committed Aug 7, 2023
1 parent 9d6539b commit 10cfacf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,25 @@ const SelectAllCheckbox = ({appSettings, set_appSettings}: {
appSettings: TSettings,
set_appSettings: (s: TSettings) => void
}): ReactElement | null => {
useEffect((): void => {
const isAllSelected = [
appSettings.shouldShowMissingTranslations,
appSettings.shouldShowIcons,
appSettings.shouldShowPrice,
appSettings.shouldShowRetirement,
appSettings.shouldShowYearnMetaFile,
appSettings.shouldShowLedgerLive,
appSettings.shouldShowStrategies,
appSettings.shouldShowRisk,
appSettings.shouldShowRiskScore,
appSettings.shouldShowDescriptions,
appSettings.shouldShowAPY,
appSettings.shouldShowWantTokenDescription
].every(Boolean);

set_appSettings({...appSettings, shouldShowAllFilters: isAllSelected});
}, [appSettings, set_appSettings]);

return <label
htmlFor={'checkbox-anomalies'}
className={'flex w-fit cursor-pointer flex-row items-center rounded-lg bg-neutral-200/60 p-2 font-mono text-sm text-neutral-500 transition-colors hover:bg-neutral-200'}>
Expand Down

0 comments on commit 10cfacf

Please sign in to comment.