mirror of
https://github.com/tloncorp/landscape.git
synced 2024-12-18 14:21:53 +03:00
grid: AppPrefs consumes pike
This commit is contained in:
parent
a92fb139f0
commit
b23293228d
@ -3,16 +3,16 @@ import { RouteComponentProps } from 'react-router-dom';
|
||||
import { Setting } from '../components/Setting';
|
||||
import { ShipName } from '../components/ShipName';
|
||||
import { useCharge } from '../state/docket';
|
||||
import useKilnState, { useVat } from '../state/kiln';
|
||||
import useKilnState, { usePike, useVat } from '../../state/kiln';
|
||||
import { getAppName } from '../state/util';
|
||||
|
||||
export const AppPrefs = ({ match }: RouteComponentProps<{ desk: string }>) => {
|
||||
const { desk } = match.params;
|
||||
const charge = useCharge(desk);
|
||||
const vat = useVat(desk);
|
||||
const tracking = !!vat?.arak.rail;
|
||||
const otasEnabled = !vat?.arak.rail?.paused;
|
||||
const otaSource = vat?.arak.rail?.ship;
|
||||
const pike = usePike(desk);
|
||||
const tracking = !!pike?.sync;
|
||||
const otasEnabled = pike?.zest === 'live';
|
||||
const otaSource = pike?.sync?.ship;
|
||||
const toggleOTAs = useKilnState((s) => s.toggleOTAs);
|
||||
|
||||
const toggleUpdates = useCallback((on: boolean) => toggleOTAs(desk, on), [desk, toggleOTAs]);
|
||||
|
@ -8,7 +8,8 @@ import {
|
||||
kilnPause,
|
||||
kilnResume,
|
||||
getPikes,
|
||||
Pikes
|
||||
Pikes,
|
||||
Pike
|
||||
} from '@urbit/api';
|
||||
import create from 'zustand';
|
||||
import produce from 'immer';
|
||||
@ -92,6 +93,10 @@ export function useVat(desk: string): Vat | undefined {
|
||||
return useKilnState(useCallback((s) => s.vats[desk], [desk]));
|
||||
}
|
||||
|
||||
export function usePike(desk: string): Pike | undefined {
|
||||
return useKilnState(useCallback((s) => s.pikes[desk], [desk]));
|
||||
}
|
||||
|
||||
const selLag = (s: KilnState) => s.lag;
|
||||
export function useLag() {
|
||||
return useKilnState(selLag);
|
||||
|
Loading…
Reference in New Issue
Block a user