diff --git a/ui/src/logic/useSystemUpdate.tsx b/ui/src/logic/useSystemUpdate.tsx index 94bcdd1..e8834ac 100644 --- a/ui/src/logic/useSystemUpdate.tsx +++ b/ui/src/logic/useSystemUpdate.tsx @@ -1,27 +1,23 @@ -import { kilnBump, Vat } from '@urbit/api'; +import { kilnBump, Pike } from '@urbit/api'; import { partition, pick } from 'lodash'; import { useCallback } from 'react'; import { useHistory } from 'react-router-dom'; import api from '../state/api'; import { useCharges } from '../state/docket'; -import useKilnState, { useVat } from '../state/kiln'; +import useKilnState, { usePike } from '../../state/kiln'; -export function vatIsBlocked(newKelvin: number | undefined, vat: Vat) { - if (!newKelvin) { - return false; - } - - return !(vat.arak?.rail?.next || []).find(({ weft }) => weft.kelvin === newKelvin); +function pikeIsBlocked(newKelvin: number, pike: Pike) { + return !pike.wefts?.find(({ kelvin }) => kelvin === newKelvin); } export function useSystemUpdate() { const { push } = useHistory(); - const base = useVat('base'); + const basePike = usePike('base'); const update = base?.arak?.rail?.next?.[0]; - const newKelvin = update?.weft?.kelvin; + const newKelvin = basePike?.wefts[0]?.kelvin ?? 418; const charges = useCharges(); const [blocked] = useKilnState((s) => { - const [b, u] = partition(Object.entries(s.vats), ([, vat]) => vatIsBlocked(newKelvin, vat)); + const [b, u] = partition(Object.entries(s.pikes), ([, pike]) => pikeIsBlocked(newKelvin, pike)); return [b.map(([d]) => d), u.map(([d]) => d)] as const; }); diff --git a/ui/src/preferences/AppPrefs.tsx b/ui/src/preferences/AppPrefs.tsx index 763d493..4df62d2 100644 --- a/ui/src/preferences/AppPrefs.tsx +++ b/ui/src/preferences/AppPrefs.tsx @@ -3,7 +3,7 @@ import { RouteComponentProps } from 'react-router-dom'; import { Setting } from '../components/Setting'; import { ShipName } from '../components/ShipName'; import { useCharge } from '../state/docket'; -import useKilnState, { usePike, useVat } from '../../state/kiln'; +import useKilnState, { usePike } from '../../state/kiln'; import { getAppName } from '../state/util'; export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => {