From 2592ef673b740912599f30bbed0cb8abde788a92 Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Tue, 28 Sep 2021 13:58:28 +1000 Subject: [PATCH] grid: fix settings rendering if no upstream --- pkg/grid/src/nav/preferences/AppPrefs.tsx | 25 ++++++++++++++--------- pkg/grid/src/state/mock-data.ts | 17 ++++++++------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/pkg/grid/src/nav/preferences/AppPrefs.tsx b/pkg/grid/src/nav/preferences/AppPrefs.tsx index 94419b004a..17d3464bc8 100644 --- a/pkg/grid/src/nav/preferences/AppPrefs.tsx +++ b/pkg/grid/src/nav/preferences/AppPrefs.tsx @@ -9,8 +9,9 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => { const { desk } = match.params; const charge = useCharge(desk); const vat = useVat(desk); - const otasEnabled = !vat?.arak.rail?.paused; - const otaSource = vat?.arak.rail!.ship; + const tracking = !!vat?.arak.rail; + const otasEnabled = vat?.arak.rail?.paused; + const otaSource = vat?.arak.rail?.ship; const toggleOTAs = useKilnState((s) => s.toggleOTAs); const toggleUpdates = useCallback((on: boolean) => toggleOTAs(desk, on), [desk, toggleOTAs]); @@ -19,14 +20,18 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => { <>

{charge?.title} Settings

- -

Automatically download and apply updates to keep {charge?.title} up to date.

- {otaSource && ( -

- OTA Source: -

- )} -
+ {tracking ? ( + +

Automatically download and apply updates to keep {charge?.title} up to date.

+ {otaSource && ( +

+ OTA Source: +

+ )} +
+ ) : ( +

No settings

+ )}
); diff --git a/pkg/grid/src/state/mock-data.ts b/pkg/grid/src/state/mock-data.ts index 5e15b826cb..9a0519bab8 100644 --- a/pkg/grid/src/state/mock-data.ts +++ b/pkg/grid/src/state/mock-data.ts @@ -342,13 +342,16 @@ export const mockVat = (desk: string, blockers?: boolean): Vat => ({ sub: [], add: [] }, - rail: { - aeon: 3, - desk, - next: blockers ? [{ aeon: 3, weft: { name: 'zuse', kelvin: 419 } }] : [], - ship: '~zod', - paused: desk === 'groups' - } + rail: + desk === 'uniswap' + ? null + : { + aeon: 3, + desk, + next: blockers ? [{ aeon: 3, weft: { name: 'zuse', kelvin: 419 } }] : [], + ship: '~zod', + paused: desk === 'groups' + } }, hash: '0vh.lhfn6.julg1.fs52d.g2lqj.q5kp0.2o7j3.2bljl.jdm34.hd46v.9uv5v' });