grid: fix settings rendering if no upstream

This commit is contained in:
Liam Fitzgerald 2021-09-28 13:58:28 +10:00
parent ba353fbd36
commit 2592ef673b
2 changed files with 25 additions and 17 deletions

View File

@ -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,6 +20,7 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => {
<>
<h2 className="h3 mb-7">{charge?.title} Settings</h2>
<div className="space-y-3">
{tracking ? (
<Setting on={!!otasEnabled} toggle={toggleUpdates} name="Automatic Updates">
<p>Automatically download and apply updates to keep {charge?.title} up to date.</p>
{otaSource && (
@ -27,6 +29,9 @@ export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => {
</p>
)}
</Setting>
) : (
<h4 className="text-gray-500">No settings</h4>
)}
</div>
</>
);

View File

@ -342,7 +342,10 @@ export const mockVat = (desk: string, blockers?: boolean): Vat => ({
sub: [],
add: []
},
rail: {
rail:
desk === 'uniswap'
? null
: {
aeon: 3,
desk,
next: blockers ? [{ aeon: 3, weft: { name: 'zuse', kelvin: 419 } }] : [],