grid: remove deprecated Vats state + helpers

This commit is contained in:
tomholford 2022-11-04 00:21:03 -07:00
parent 231d87b4ac
commit 089d67eb31
2 changed files with 2 additions and 62 deletions

View File

@ -1,25 +1,12 @@
import {
getVats,
Vats,
scryLag,
getBlockers,
Vat,
kilnInstall,
kilnPause,
kilnResume,
getPikes,
Pikes,
Pike
} from '@urbit/api';
import { scryLag, kilnInstall, kilnPause, kilnResume, getPikes, Pikes, Pike } from '@urbit/api';
import create from 'zustand';
import produce from 'immer';
import { useCallback } from 'react';
import api from './api';
import { fakeRequest, useMockData } from './util';
import { mockPikes, mockVats } from './mock-data';
import { mockPikes } from './mock-data';
interface KilnState {
vats: Vats;
pikes: Pikes;
loaded: boolean;
lag: boolean;
@ -31,7 +18,6 @@ interface KilnState {
initializeKiln: () => Promise<void>;
}
const useKilnState = create<KilnState>((set, get) => ({
vats: {},
pikes: useMockData ? mockPikes : {},
lag: false,
loaded: false,
@ -73,15 +59,6 @@ const useKilnState = create<KilnState>((set, get) => ({
}
}));
const selBlockers = (s: KilnState) => getBlockers(s.vats);
export function useBlockers() {
return useKilnState(selBlockers);
}
export function useVat(desk: string): Vat | undefined {
return useKilnState(useCallback((s) => s.vats[desk], [desk]));
}
const selPikes = (s: KilnState) => s.pikes;
export function usePikes(): Pikes {
return useKilnState(selPikes);

View File

@ -1,6 +1,4 @@
import {
Vat,
Vats,
Allies,
Charges,
DocketHrefGlob,
@ -342,41 +340,6 @@ export const mockContacts: Contacts = {
}
};
export const mockVat = (desk: string, blockers?: boolean): Vat => ({
cass: {
da: '~2021.9.13..05.41.04..ae65',
ud: 1
},
desk,
arak: {
rein: {
sub: [],
add: []
},
rail:
desk === 'uniswap'
? null
: {
aeon: 3,
desk,
publisher: '~zod',
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'
});
const badVats = ['inbox', 'system', 'terminal', 'base'];
export const mockVats = _.reduce(
mockCharges,
(vats, charge, desk) => {
return { ...vats, [desk]: mockVat(desk, !badVats.includes(desk)) };
},
{ base: mockVat('base', true) } as Vats
);
export const mockPikes: Pikes = {
kids: {
sync: null,