1import { useEffect, useMemo, useState } from 'react';
2import * as need from 'lib/need';
3import { usePointCache } from 'store/pointCache';
4import { usePointCursor } from 'store/pointCursor';
5import { useRollerStore } from 'store/roller';
6import { convertToInt } from 'lib/convertToInt';
7import { isPlanet } from 'lib/utils/point';
9export const useHasNetworkKeysSet = () => {
10 const { pointCursor } = usePointCursor();
11 const { getDetails } = usePointCache();
12 const { currentL2 } = useRollerStore();
13 const point = pointCursor.getOrElse(null);
14 const [networkKeysSet, setNetworkKeysSet] = useState<boolean>(true);
18 const details = need.details(getDetails(point));
19 const isStarOrGalaxy = !isPlanet(point);
20 const networkRevision = convertToInt(details.keyRevisionNumber, 10);
21 const networkKeysNotSet =
22 !currentL2 && isStarOrGalaxy && networkRevision === 0;
23 setNetworkKeysSet(!networkKeysNotSet);
25 }, [currentL2, getDetails, point, pointCursor]);
27 return useMemo(() => {
28 return networkKeysSet;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list