on master help sign in
ux: new user network keys flow enhancements
495e4fetomholford
src/types/PointDetailsType.tsnew file+28
@@ -0,0 +1,28 @@
1+// Response returned by azimuth#getPoint
2+export type PointDetails = {
3+ 0: string;
4+ 1: string;
5+ 2: string;
6+ 3: string;
7+ 4: string;
8+ 5: string;
9+ 6: string;
10+ 7: string;
11+ 8: string;
12+ 9: string;
13+ active: boolean;
14+ authenticationKey: string;
15+ continuityNumber: string;
16+ cryptoSuiteVersion: string;
17+ encryptionKey: string;
18+ escapeRequested: boolean;
19+ escapeRequestedTo: string;
20+ hasSponsor: boolean;
21+ keyRevisionNumber: string;
22+ managementProxy: string;
23+ owner: string;
24+ spawnProxy: string;
25+ sponsor: string;
26+ transferProxy: string;
27+ votingProxy: string;
28+};
src/views/UrbitOS/Home.js → src/views/UrbitOS/Home.tsxrenamed+26−11
@@ -12,6 +12,8 @@ import { ForwardButton } from 'components/Buttons';
12import NetworkingKeys from 'components/NetworkingKeys';
12import NetworkingKeys from 'components/NetworkingKeys';
13
13
14import { useLocalRouter } from 'lib/LocalRouter';
14import { useLocalRouter } from 'lib/LocalRouter';
15+import { PointDetails } from 'types/pointDetailsType';
16+import WarningBox from 'components/WarningBox';
15
17
16export default function UrbitOSHome({ manualNetworkSeed }) {
18export default function UrbitOSHome({ manualNetworkSeed }) {
17 const { pointCursor } = usePointCursor();
19 const { pointCursor } = usePointCursor();
@@ -20,7 +22,7 @@ export default function UrbitOSHome({ manualNetworkSeed }) {
20 const { push, names } = useLocalRouter();
22 const { push, names } = useLocalRouter();
21
23
22 const point = need.point(pointCursor);
24 const point = need.point(pointCursor);
23− const details = need.details(getDetails(point));
25+ const details: PointDetails = need.details(getDetails(point));
24
26
25 const sponsor = ob.patp(details.sponsor);
27 const sponsor = ob.patp(details.sponsor);
26
28
@@ -29,6 +31,10 @@ export default function UrbitOSHome({ manualNetworkSeed }) {
29 const showSponsor = azimuth.getPointSize(point) !== azimuth.PointSize.Galaxy;
31 const showSponsor = azimuth.getPointSize(point) !== azimuth.PointSize.Galaxy;
30 const toggleShowKeys = useCallback(() => setShowKeys(s => !s), [setShowKeys]);
32 const toggleShowKeys = useCallback(() => setShowKeys(s => !s), [setShowKeys]);
31
33
34+ // The initial key revision number is 0, and increments when set
35+ const hasSetNetworkingKeys = details.keyRevisionNumber !== '0';
36+ const networkKeysAction = hasSetNetworkingKeys ? 'Reset' : 'Initiate';
37+
32 const goNetworkingKeys = useCallback(() => push(names.NETWORKING_KEYS), [
38 const goNetworkingKeys = useCallback(() => push(names.NETWORKING_KEYS), [
33 names,
39 names,
34 push,
40 push,
@@ -61,17 +67,26 @@ export default function UrbitOSHome({ manualNetworkSeed }) {
61
67
62 <Grid.Divider />
68 <Grid.Divider />
63 <Grid.Item full as={ForwardButton} onClick={goNetworkingKeys}>
69 <Grid.Item full as={ForwardButton} onClick={goNetworkingKeys}>
64− Reset Networking Keys
65− </Grid.Item>
66− <Grid.Divider />
67− <Grid.Item
68− full
69− as={ForwardButton}
70− accessory={showKeys ? '▼' : '▲'}
71− onClick={toggleShowKeys}>
72− View Networking Keys
70+ {networkKeysAction} Networking Keys
73 </Grid.Item>
71 </Grid.Item>
72+ {hasSetNetworkingKeys && (
73+ <>
74+ <Grid.Divider />
75+ <Grid.Item
76+ full
77+ as={ForwardButton}
78+ accessory={showKeys ? '▼' : '▲'}
79+ onClick={toggleShowKeys}>
80+ View Networking Keys
81+ </Grid.Item>
74− {showKeys && <Grid.Item full as={NetworkingKeys} point={point} />}
82+ {showKeys && <Grid.Item full as={NetworkingKeys} point={point} />}
83+ </>
84+ )}
85+ {!hasSetNetworkingKeys && (
86+ <Grid.Item full as={WarningBox} className="mt4">
87+ Networking Keys are required to generate a keyfile
88+ </Grid.Item>
89+ )}
75 </Grid>
90 </Grid>
76 </>
91 </>
77 );
92 );