From 10cfacff54af03a9021cd3bbf035f6eef1aa67a4 Mon Sep 17 00:00:00 2001 From: Karelian Pie Date: Mon, 7 Aug 2023 15:38:53 +0300 Subject: [PATCH] feat: Listen for single filter changes for overall filter --- pages/index.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pages/index.tsx b/pages/index.tsx index 0906f21..b1c3178 100755 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -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