From 2887008487a98922cc78661dd40eb44601be2d5e Mon Sep 17 00:00:00 2001 From: tomholford Date: Mon, 7 Nov 2022 17:52:13 -0800 Subject: [PATCH] prefs: use sync.pike to discern if OTAs enabled Also, remove the conditional rendering logic for AppPrefs. With the new logic (and before this change) if the User disables OTAs, the toggle would disappear, which feels like an antipattern. --- pkg/grid/src/nav/preferences/AppPrefs.tsx | 23 ++++++++----------- .../src/nav/preferences/SystemUpdatePrefs.tsx | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/pkg/grid/src/nav/preferences/AppPrefs.tsx b/pkg/grid/src/nav/preferences/AppPrefs.tsx index 91109cd23..496cdef2f 100644 --- a/pkg/grid/src/nav/preferences/AppPrefs.tsx +++ b/pkg/grid/src/nav/preferences/AppPrefs.tsx @@ -10,8 +10,7 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => { const { desk } = match.params; const charge = useCharge(desk); const pike = usePike(desk); - const tracking = !!pike?.sync; - const otasEnabled = pike?.zest === 'live'; + const otasEnabled = !!pike?.sync; const otaSource = pike?.sync?.ship; const toggleOTAs = useKilnState((s) => s.toggleOTAs); @@ -21,18 +20,14 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => { <>

{getAppName(charge)} Settings

- {tracking ? ( - -

Automatically download and apply updates to keep {getAppName(charge)} up to date.

- {otaSource && ( -

- OTA Source: -

- )} -
- ) : ( -

No settings

- )} + +

Automatically download and apply updates to keep {getAppName(charge)} up to date.

+ {otaSource && ( +

+ OTA Source: +

+ )} +
); diff --git a/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx b/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx index 50508c4c0..d8dc3fcd9 100644 --- a/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx +++ b/pkg/grid/src/nav/preferences/SystemUpdatePrefs.tsx @@ -12,7 +12,7 @@ export const SystemUpdatePrefs = () => { _.pick(s, ['toggleOTAs', 'changeOTASource']) ); const pike = usePike('base'); - const otasEnabled = pike?.zest === 'live'; + const otasEnabled = !!pike?.sync; const otaSource = pike?.sync?.ship; const toggleBase = useCallback((on: boolean) => toggleOTAs('base', on), [toggleOTAs]);