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