on master help sign in
Center buttons, Network Keys, MM fix, point polling, Points display fixes
commite5348f293ada8173505d79d2babaf95c8cc15e91 authorWill Galebach <willbach@gmail.com> dateMon 6 Dec 2021, 14:41 (5 years ago) parent535250a
21 files changed+131−281
src/components/Buttons.js+6−4 src/components/NetworkingKeys.js → src/components/NetworkKeys.js+1−1 src/lib/constants.ts+2 src/lib/keys.js+1−1 src/lib/router.js−2 src/lib/types/Point.ts+3 src/lib/useKeyfileGenerator.js+7−7 src/lib/useRoller.ts+2−2 src/store/lib/useControlledPointsStore.js+8 src/views/Activate/MasterKeyDownload.tsx+2−2 src/views/CancelTransfer.js+1−1 src/views/Login/Mnemonic.tsx+18−21 src/views/Ops/Adopt.tsx−103 src/views/Ops/Requests.tsx+11−37 src/views/Ops/ResidentRow.tsx+18−24 src/views/Party/PartySetPoolSize.js+1−1 src/views/Point/Point.tsx+1−2 src/views/Point/UrbitOS.js+2−2 src/views/Points.js+24−48 src/views/UrbitOS/Home.tsx+12−12 src/views/UrbitOS/NetworkingKeys.js → src/views/UrbitOS/NetworkKeys.js+11−11
src/components/Buttons.js+6−4
@@ -6,17 +6,19 @@ import { blinkIf } from './Blinky';
66
77// NOTE: the -> is correct because inter recognizes the pair
88export const ForwardButton = ({ loading, ...props }) => (
9− <Button accessory={blinkIf(loading, '->')} {...props} />
9+ <Button accessory={blinkIf(loading, '->')} {...props} center />
1010);
1111export const DownloadButton = ({ loading, ...props }) => (
12− <Button accessory={blinkIf(loading, '↓')} {...props} />
12+ <Button accessory={blinkIf(loading, '↓')} {...props} center />
13+);
14+export const RestartButton = props => (
15+ <Button accessory="↺" {...props} center />
1316);
14−export const RestartButton = props => <Button accessory="↺" {...props} />;
1517export const GenerateButton = ({ loading, ...props }) => (
1618 <Button accessory={blinkIf(loading, '○')} solid {...props} />
1719);
1820export const OutButton = props => (
19− <Button as="a" target="_blank" accessory="↗" {...props} />
21+ <Button as="a" target="_blank" accessory="↗" {...props} center />
2022);
2123
2224export const OfflineButton = props => (
src/components/NetworkingKeys.js → src/components/NetworkKeys.jsrenamed+1−1
@@ -20,7 +20,7 @@ const renderNetworkKey = key => {
2020 return segments.join('\n');
2121};
2222
23−export default function NetworkingKeys({ point }) {
23+export default function NetworkKeys({ point }) {
2424 const { getDetails, getRekeyDate } = usePointCache();
2525
2626 const details = getDetails(point);
src/lib/constants.ts+2
@@ -168,6 +168,7 @@ const DUMMY_L2_ADDRESS = '0x1111111111111111111111111111111111111111';
168168const ONE_SECOND = 1000;
169169const TWO_SECONDS = 2 * ONE_SECOND;
170170const TEN_SECONDS = 10 * ONE_SECOND;
171+const ONE_MINUTE = 60 * ONE_SECOND;
171172
172173const MASTER_TICKET_TOOLTIP =
173174 'Your Master Ticket is your 4-word password for your Urbit';
@@ -217,6 +218,7 @@ export {
217218 ONE_SECOND,
218219 TWO_SECONDS,
219220 TEN_SECONDS,
221+ ONE_MINUTE,
220222 MASTER_TICKET_TOOLTIP,
221223 PASSPORT_TOOLTIP,
222224};
src/lib/keys.js+1−1
@@ -69,7 +69,7 @@ export const createRing = pair =>
6969 * @param {number} revision
7070 * @return {string}
7171 */
72−export const compileNetworkingKey = (pair, point, revision) => {
72+export const compileNetworkKey = (pair, point, revision) => {
7373 const bnsec = new BN(createRing(pair), 'hex');
7474
7575 const sed = noun.dwim(
src/lib/router.js−2
@@ -22,7 +22,6 @@ import PartySetPoolSize from 'views/Party/PartySetPoolSize';
2222import InviteCohort from 'views/Invite/Cohort';
2323import AcceptTransfer from 'views/AcceptTransfer';
2424import CancelTransfer from 'views/CancelTransfer';
25−import Adopt from 'views/Ops/Adopt.tsx';
2625import Bitcoin from 'views/Bitcoin/Bitcoin';
2726import Xpub from 'views/Bitcoin/Xpub';
2827import SignTransaction from 'views/Bitcoin/SignTransaction';
@@ -56,7 +55,6 @@ export const ROUTES = {
5655 [ROUTE_NAMES.URBIT_ID]: UrbitID,
5756 [ROUTE_NAMES.RESIDENTS]: Residents,
5857 [ROUTE_NAMES.REQUESTS]: Requests,
59− [ROUTE_NAMES.ADOPT]: Adopt,
6058 [ROUTE_NAMES.BITCOIN]: Bitcoin,
6159 [ROUTE_NAMES.BITCOIN_XPUB]: Xpub,
6260 [ROUTE_NAMES.BITCOIN_SIGN_TRANSACTION]: SignTransaction,
src/lib/types/Point.ts+3
@@ -111,6 +111,7 @@ export default class Point {
111111 isPlaceholder: boolean;
112112 ownManageSpawn: boolean;
113113 shouldDisplay: boolean;
114+ isOutgoing: boolean;
114115
115116 constructor({
116117 value,
@@ -180,6 +181,8 @@ export default class Point {
180181 !this.isDefault &&
181182 (this.isOwner || this.isSpawnProxy || this.isManagementProxy);
182183 this.shouldDisplay = this.ownManageSpawn || this.isTransferProxy;
184+ this.isOutgoing =
185+ this.isTransferProxySet && this.isTransferProxy && this.canManage;
183186 }
184187
185188 equals = (point: Point) => {
src/lib/useKeyfileGenerator.js+7−7
@@ -14,7 +14,7 @@ import {
1414 attemptNetworkSeedDerivation,
1515 keysMatchChain,
1616 deriveNetworkKeys,
17− compileNetworkingKey,
17+ compileNetworkKey,
1818} from './keys';
1919import useCurrentPermissions from './useCurrentPermissions';
2020import { convertToInt } from './convertToInt';
@@ -40,14 +40,14 @@ export default function useKeyfileGenerator(manualNetworkSeed) {
4040 });
4141 const { isOwner, isManagementProxy } = useCurrentPermissions();
4242
43− const hasNetworkingKeys = networkRevision > 0;
43+ const hasNetworkKeys = networkRevision > 0;
4444 const available =
45− (isOwner || isManagementProxy) && hasNetworkingKeys && !!keyfile;
45+ (isOwner || isManagementProxy) && hasNetworkKeys && !!keyfile;
4646
4747 const generate = useCallback(async () => {
48− if (!hasNetworkingKeys) {
48+ if (!hasNetworkKeys) {
4949 setGenerating(false);
50− setNotice('Networking keys not yet set.');
50+ setNotice('Network keys not yet set.');
5151 console.log(
5252 `no networking keys available for revision ${networkRevision}`
5353 );
@@ -90,11 +90,11 @@ export default function useKeyfileGenerator(manualNetworkSeed) {
9090
9191 setNotice();
9292 setCode(generateCode(pair));
93− setKeyfile(compileNetworkingKey(pair, _point, networkRevision));
93+ setKeyfile(compileNetworkKey(pair, _point, networkRevision));
9494 setGenerating(false);
9595 }, [
9696 networkRevision,
97− hasNetworkingKeys,
97+ hasNetworkKeys,
9898 manualNetworkSeed,
9999 urbitWallet,
100100 wallet,
src/lib/useRoller.ts+2−2
@@ -588,7 +588,7 @@ export default function useRoller() {
588588 customNetworkSeed?: string;
589589 }
590590
591− const configureNetworkingKeys = useCallback(
591+ const configureNetworkKeys = useCallback(
592592 async ({ breach, customNetworkSeed }: ConfigureKeysParams) => {
593593 if (quotaReached()) {
594594 return;
@@ -1024,7 +1024,7 @@ export default function useRoller() {
10241024 cancelEscape,
10251025 checkForUpdates,
10261026 config,
1027− configureNetworkingKeys,
1027+ configureNetworkKeys,
10281028 generateInviteCodes,
10291029 getInvites,
10301030 getPoints,
src/store/lib/useControlledPointsStore.js+8
@@ -7,6 +7,7 @@ import { useWallet } from 'store/wallet';
77import useRoller from 'lib/useRoller';
88import { onlyUnique } from 'lib/utils/array';
99import { useNetwork } from '../network';
10+import { ONE_MINUTE } from 'lib/constants';
1011
1112export default function useControlledPointsStore() {
1213 const { contracts } = useNetwork();
@@ -121,6 +122,13 @@ export default function useControlledPointsStore() {
121122 syncControlledPoints();
122123 }, [syncControlledPoints]);
123124
125+ // Poll the roller every minute for changes to the points
126+ useEffect(() => {
127+ setInterval(() => {
128+ syncControlledPoints();
129+ }, ONE_MINUTE);
130+ }, []); // eslint-disable-line react-hooks/exhaustive-deps
131+
124132 return {
125133 controlledPoints,
126134 syncControlledPoints,
src/views/Activate/MasterKeyDownload.tsx+2−2
@@ -14,7 +14,7 @@ import { FadeableMasterKeyPresenter as MasterKeyPresenter } from './MasterKeyPre
1414import { useActivateFlow } from './ActivateFlow';
1515import ActivateView from './ActivateView';
1616import { useLocalRouter } from 'lib/LocalRouter';
17−import { compileNetworkingKey } from 'lib/keys';
17+import { compileNetworkKey } from 'lib/keys';
1818import { downloadWallet } from 'lib/invite';
1919import PaperBuilder from 'components/PaperBuilder';
2020import { DEFAULT_FADE_TIMEOUT, MASTER_KEY_DURATION } from 'lib/constants';
@@ -47,7 +47,7 @@ const MasterKeyDownload = () => {
4747 });
4848
4949 const download = useCallback(async () => {
50− const netkey = compileNetworkingKey(wallet.network.keys, point, 1);
50+ const netkey = compileNetworkKey(wallet.network.keys, point, 1);
5151 //TODO could be deduplicated with useKeyfileGenerator's logic
5252 const filename = ob.patp(point).slice(1) + '-1.key';
5353 await downloadWallet(paper.getOrElse([]), netkey, filename);
src/views/CancelTransfer.js+1−1
@@ -108,7 +108,7 @@ function AdminCancelTransfer() {
108108 <Grid.Item
109109 as={Button}
110110 full
111− className="set-proxy mt4"
111+ className="set-proxy mt4 w-full"
112112 center
113113 solid
114114 onClick={cancelTransfer}>
src/views/Login/Mnemonic.tsx+18−21
@@ -36,12 +36,11 @@ export default function Mnemonic({ className, goHome }: MnemonicProps) {
3636
3737 const { setWallet, setAuthMnemonic, setWalletHdPath }: any = useWallet();
3838
39− const [anyMnemonic, setAnyMnemonic] = useState(false);
4039 const [skipValidation, setSkipValidation] = useState(false);
4140 const [phraseHdPath, setPhraseHdPath] = useState(false);
4241
4342 const validate = useMemo(() => {
44− const mnemonicValidator = anyMnemonic
43+ const mnemonicValidator = skipValidation
4544 ? buildAnyMnemonicValidator()
4645 : buildMnemonicValidator();
4746 return composeValidator({
@@ -50,12 +49,11 @@ export default function Mnemonic({ className, goHome }: MnemonicProps) {
5049 passphrase: buildPassphraseValidator(),
5150 hdpath: buildHdPathValidator(),
5251 });
53− }, [anyMnemonic]);
52+ }, [skipValidation]);
5453
5554 // when the properties change, re-derive wallet and set global state
5655 const onValues = useCallback(
5756 ({ valid, values }) => {
58− setAnyMnemonic(values.anyMnemonic);
5957 if (valid) {
6058 setWalletHdPath(values.hdpath);
6159 setAuthMnemonic(Just(values.mnemonic));
@@ -64,7 +62,7 @@ export default function Mnemonic({ className, goHome }: MnemonicProps) {
6462 values.mnemonic,
6563 values.hdpath,
6664 values.passphrase,
67− values.anyMnemonic
65+ skipValidation
6866 )
6967 );
7068 } else {
@@ -72,7 +70,7 @@ export default function Mnemonic({ className, goHome }: MnemonicProps) {
7270 setWallet(Nothing());
7371 }
7472 },
75− [setAuthMnemonic, setWallet, setWalletHdPath]
73+ [setAuthMnemonic, setWallet, setWalletHdPath, skipValidation]
7674 );
7775
7876 const initialValues = {
@@ -115,22 +113,21 @@ export default function Mnemonic({ className, goHome }: MnemonicProps) {
115113 <Grid.Item full>
116114 <Grid.Item full as={MnemonicInput} name="mnemonic" />
117115
118− {skipValidation && (
119− <Grid.Item
120− full
121− as={PassphraseInput}
122− name="passphrase"
123− label="Passphrase"
124− />
125− )}
126−
127116 {phraseHdPath && (
128− <Grid.Item
129− full
130− as={HdPathInput}
131− name="hdpath"
132− label="HD Path"
133− />
117+ <>
118+ <Grid.Item
119+ full
120+ as={PassphraseInput}
121+ name="passphrase"
122+ label="Passphrase"
123+ />
124+ <Grid.Item
125+ full
126+ as={HdPathInput}
127+ name="hdpath"
128+ label="HD Path"
129+ />
130+ </>
134131 )}
135132
136133 <Grid.Item full as={FormError} />
src/views/Ops/Adopt.tsxdeleted−103
@@ -1,103 +0,0 @@
1−import React, { useCallback, useEffect, useMemo } from 'react';
2−import { Grid } from 'indigo-react';
3−import * as ob from 'urbit-ob';
4−import { ecliptic } from 'azimuth-js';
5−
6−import { useNetwork } from 'store/network';
7−import { usePointCache } from 'store/pointCache';
8−import { usePointCursor } from 'store/pointCursor';
9−import { useHistory } from 'store/history';
10−
11−import * as need from 'lib/need';
12−import { GAS_LIMITS } from 'lib/constants';
13−import useEthereumTransaction from 'lib/useEthereumTransaction';
14−
15−import InlineEthereumTransaction from 'components/InlineEthereumTransaction';
16−import Window from 'components/L2/Window/Window';
17−import HeaderPane from 'components/L2/Window/HeaderPane';
18−import BodyPane from 'components/L2/Window/BodyPane';
19−import View from 'components/View';
20−import L2BackHeader from 'components/L2/Headers/L2BackHeader';
21−import { Row } from '@tlon/indigo-react';
22−
23−function useAdopt() {
24− const { contracts }: any = useNetwork();
25− const _contracts = need.contracts(contracts);
26−
27− const { pointCursor }: any = usePointCursor();
28− const point = need.point(pointCursor);
29−
30− const { syncResidents }: any = usePointCache();
31−
32− return useEthereumTransaction(
33− useCallback(
34− (adoptee: number, denied: boolean) =>
35− denied
36− ? ecliptic.reject(_contracts, adoptee)
37− : ecliptic.adopt(_contracts, adoptee),
38− [_contracts]
39− ),
40− useCallback(() => syncResidents(point), [syncResidents, point]),
41− GAS_LIMITS.DEFAULT
42− );
43−}
44−
45−export default function Adopt() {
46− const { pop, data }: any = useHistory();
47−
48− const { adoptee, denied } = data;
49−
50− const patp = useMemo(() => ob.patp(adoptee), [adoptee]);
51−
52− const { construct, bind, completed } = useAdopt();
53−
54− const body = useMemo(
55− () =>
56− denied ? (
57− <>
58− {completed ? 'Rejected' : 'Rejecting'} adoption request for{' '}
59− <span className="mono">{patp}</span>
60− </>
61− ) : (
62− <>
63− {completed ? 'Approved' : 'Approving'} adoption request for{' '}
64− <span className="mono">{patp}</span>
65− </>
66− ),
67− [patp, denied, completed]
68− );
69−
70− useEffect(() => {
71− construct(adoptee, denied);
72− }, [construct, adoptee, denied]);
73−
74− const headerText = `${denied ? 'Reject' : 'Approve'} Adoption Request`;
75−
76− return (
77− <View
78− className="adopt-l1"
79− pop={pop}
80− inset
81− hideBack
82− header={<L2BackHeader hideBalance back={pop} />}>
83− <Window>
84− <HeaderPane>
85− <Row className="header-row">
86− <h5>{headerText}</h5>
87− </Row>
88− </HeaderPane>
89− <BodyPane>
90− <Grid.Item className="f5 mv2 w-full" style={{ fontSize: 14 }}>
91− {body}
92− </Grid.Item>
93− <Grid.Item
94− full
95− {...bind}
96− as={InlineEthereumTransaction}
97− onReturn={() => pop()}
98− />
99− </BodyPane>
100− </Window>
101− </View>
102− );
103−}
src/views/Ops/Requests.tsx+11−37
@@ -16,7 +16,7 @@ import { RequestRow } from './RequestRow';
1616import './Requests.scss';
1717
1818export const Requests = () => {
19− const { pop, push, names }: any = useLocalRouter();
19+ const { pop }: any = useLocalRouter();
2020 const { point, setLoading } = useRollerStore();
2121 const { api, changeSponsorship } = useRoller();
2222 const [requestingPoints, setRequestingPoints] = useState<Ship[]>([]);
@@ -32,50 +32,24 @@ export const Requests = () => {
3232 setLoading(false);
3333 }, [api, point, setLoading]);
3434
35− const acceptL1 = useCallback(
36− adoptee =>
37− push(names.ADOPT, {
38− adoptee,
39− denied: false,
40− }),
41− [push, names]
42− );
43−
44− const rejectL1 = useCallback(
45− adoptee =>
46− push(names.ADOPT, {
47− adoptee,
48− denied: true,
49− }),
50− [push, names]
51− );
52−
5335 const handleAcceptClick = useCallback(
5436 async (ship: Ship) => {
55− if (point.isL1) {
56− acceptL1(ship);
57− } else {
58− setLoading(true);
59− await changeSponsorship(ship, 'adopt');
60− await fetchRequests();
61− setLoading(false);
62− }
37+ setLoading(true);
38+ await changeSponsorship(ship, 'adopt');
39+ await fetchRequests();
40+ setLoading(false);
6341 },
64− [point, acceptL1, changeSponsorship, fetchRequests, setLoading]
42+ [changeSponsorship, fetchRequests, setLoading]
6543 );
6644
6745 const handleRejectClick = useCallback(
6846 async (ship: Ship) => {
69− if (point.isL1) {
70− rejectL1(ship);
71− } else {
72− setLoading(true);
73− await changeSponsorship(ship, 'reject');
74− await fetchRequests();
75− setLoading(false);
76− }
47+ setLoading(true);
48+ await changeSponsorship(ship, 'reject');
49+ await fetchRequests();
50+ setLoading(false);
7751 },
78− [point, rejectL1, changeSponsorship, fetchRequests, setLoading]
52+ [changeSponsorship, fetchRequests, setLoading]
7953 );
8054
8155 useEffect(() => {
src/views/Ops/ResidentRow.tsx+18−24
@@ -4,7 +4,6 @@ import { Ship } from '@urbit/roller-api';
44import Sigil from 'components/Sigil';
55import { useCallback, useRef, useState } from 'react';
66import useOnClickOutside from 'lib/useOnClickOutside';
7−import { useRollerStore } from 'store/rollerStore';
87
98interface ResidentRowProps {
109 point: Ship;
@@ -12,9 +11,6 @@ interface ResidentRowProps {
1211}
1312
1413export const ResidentRow = ({ point, onKick }: ResidentRowProps) => {
15− const {
16− point: { isL2 },
17− } = useRollerStore();
1814 const [showDropdown, setShowDropdown] = useState<boolean>(false);
1915 const dropdownRef = useRef<HTMLDivElement | null>(null);
2016
@@ -45,26 +41,24 @@ export const ResidentRow = ({ point, onKick }: ResidentRowProps) => {
4541 </Box>
4642 <Box className={'patp'}>{ob.patp(point)}</Box>
4743 </Box>
48− {isL2 && (
49− <Box className="button-wrapper" ref={dropdownRef}>
50− <Icon
51− icon="Ellipsis"
52− size="18px"
53− onClick={() => setShowDropdown(!showDropdown)}
54− />
55− {showDropdown && (
56− <>
57− <Box
58− className="close-background"
59− onClick={() => setShowDropdown(false)}
60− />
61− <Box className="kick-dropdown" onClick={handleKickClick}>
62− <Text>Kick</Text>
63− </Box>
64− </>
65− )}
66− </Box>
67− )}
44+ <Box className="button-wrapper" ref={dropdownRef}>
45+ <Icon
46+ icon="Ellipsis"
47+ size="18px"
48+ onClick={() => setShowDropdown(!showDropdown)}
49+ />
50+ {showDropdown && (
51+ <>
52+ <Box
53+ className="close-background"
54+ onClick={() => setShowDropdown(false)}
55+ />
56+ <Box className="kick-dropdown" onClick={handleKickClick}>
57+ <Text>Kick</Text>
58+ </Box>
59+ </>
60+ )}
61+ </Box>
6862 </li>
6963 );
7064};
src/views/Party/PartySetPoolSize.js+1−1
@@ -120,7 +120,7 @@ export default function PartySetPoolSize() {
120120
121121 {!hasKeysSet && (
122122 <Grid.Item full as={WarningBox} className="mb4 f6">
123− Networking keys must be configured for invitations to be available
123+ Network keys must be configured for invitations to be available
124124 for use.
125125 </Grid.Item>
126126 )}
src/views/Point/Point.tsx+1−2
@@ -229,7 +229,6 @@ export default function Point() {
229229 Invite Group <Blinky />
230230 </Grid.Item>
231231 )}
232− {/* {inviteButton} */}
233232 {(canManage || isSpawnProxy) && (
234233 <Grid.Item full as={Flex} justify="between">
235234 <Card
@@ -237,7 +236,7 @@ export default function Point() {
237236 subtitle="Master Key, Passport, Proxy Addresses, etc"
238237 icon={(<Icon icon="User" />) as any}
239238 onClick={goUrbitID}
240− disabled={!canManage}
239+ disabled={!(canManage || isSpawnProxy)}
241240 />
242241 </Grid.Item>
243242 )}
src/views/Point/UrbitOS.js+2−2
@@ -9,7 +9,7 @@ import View from 'components/View';
99import L2BackHeader from 'components/L2/Headers/L2BackHeader';
1010
1111import UrbitOSHome from '../UrbitOS/Home';
12−import UrbitOSNetworkingKeys from '../UrbitOS/NetworkingKeys';
12+import UrbitOSNetworkKeys from '../UrbitOS/NetworkKeys';
1313import UrbitOSChangeSponsor from '../UrbitOS/ChangeSponsor';
1414
1515const NAMES = {
@@ -21,7 +21,7 @@ const NAMES = {
2121const VIEWS = {
2222 [NAMES.HOME]: UrbitOSHome,
2323 [NAMES.CHANGE_SPONSOR]: UrbitOSChangeSponsor,
24− [NAMES.NETWORKING_KEYS]: UrbitOSNetworkingKeys,
24+ [NAMES.NETWORKING_KEYS]: UrbitOSNetworkKeys,
2525};
2626
2727export default function UrbitOS() {
src/views/Points.js+24−48
@@ -106,7 +106,7 @@ function ActionButtons({ actions = [] }) {
106106
107107export default function Points() {
108108 const { wallet } = useWallet();
109− const { pop, push, popAndPush, names } = useHistory();
109+ const { pop, push, names } = useHistory();
110110 const { setPointCursor } = usePointCursor();
111111 const { controlledPoints, getDetails } = usePointCache();
112112 const { contracts } = useNetwork();
@@ -119,11 +119,7 @@ export default function Points() {
119119 const { syncStarReleaseDetails, starReleaseDetails } = useStarReleaseCache();
120120
121121 const outgoingPoints = useMemo(
122− () =>
123− pointList.filter(
124− ({ isTransferProxySet, isTransferProxy }) =>
125− isTransferProxySet && !isTransferProxy
126− ),
122+ () => pointList.filter(({ isOutgoing }) => isOutgoing),
127123 [pointList]
128124 );
129125
@@ -164,47 +160,38 @@ export default function Points() {
164160 ),
165161 [getDetails, controlledPoints, _contracts]
166162 );
167− // if we can only interact with a single point, forget about the existence
168− // of this page and jump to the point page.
163+
164+ const allPoints = pointList
165+ .filter(
166+ ({ isTransferProxySet, shouldDisplay }) =>
167+ !isTransferProxySet && shouldDisplay
168+ )
169+ .map(({ value }) => value);
170+
171+ // if we can only interact with a single point, jump to the point page.
169172 // if there are any pending transfers, incoming or outgoing, stay on this
170173 // page, because those can only be completed/cancelled here.
171174 useEffect(() => {
172175 if (Nothing.hasInstance(starReleaseDetails)) {
173176 return;
174177 }
175− controlledPoints.matchWith({
176− Nothing: () => null,
177− Just: r => {
178− r.value.matchWith({
179− Error: () => null,
180− Ok: c => {
181− let all = [
182− ...c.value.ownedPoints,
183− ...c.value.votingPoints,
184− ...c.value.managingPoints,
185− ...c.value.spawningPoints,
186− ];
187− if (
188− all.length === 1 &&
189− incomingPoints.length === 0 &&
190− outgoingPoints.length === 0 &&
191− (starReleaseDetails.value === null ||
192− starReleaseDetails.value.total === 0)
193− ) {
194− setPointCursor(Just(all[0]));
195− popAndPush(names.POINT);
196− }
197− },
198− });
199− },
200− });
178+ if (
179+ allPoints.length === 1 &&
180+ incomingPoints.length === 0 &&
181+ outgoingPoints.length === 0 &&
182+ (starReleaseDetails.value === null ||
183+ starReleaseDetails.value.total === 0)
184+ ) {
185+ setPointCursor(Just(allPoints[0]));
186+ push(names.POINT);
187+ }
201188 }, [
202− controlledPoints,
189+ allPoints,
203190 rejectedPoints,
204191 outgoingPoints,
205192 incomingPoints,
206193 setPointCursor,
207− popAndPush,
194+ push,
208195 names,
209196 starReleaseDetails,
210197 ]);
@@ -216,13 +203,6 @@ export default function Points() {
216203 const ownedPoints = maybeGetResult(controlledPoints, 'ownedPoints', []);
217204 const lockedPoints = maybeLockedPoints.getOrElse([]);
218205
219− const allPoints = pointList
220− .filter(
221− ({ isTransferProxySet, shouldDisplay }) =>
222− !isTransferProxySet && shouldDisplay
223− )
224− .map(({ value }) => value);
225−
226206 const processingPoints = pointList
227207 .filter(({ shouldDisplay }) => !shouldDisplay)
228208 .map(({ value }) => value);
@@ -298,11 +278,7 @@ export default function Points() {
298278 outgoingPoints.length === 0 &&
299279 !starReleasing)
300280 ) {
301− return (
302− <View inset>
303− <LoadingOverlay loading />
304− </View>
305− );
281+ return <LoadingOverlay loading />;
306282 }
307283
308284 return (
src/views/UrbitOS/Home.tsx+12−12
@@ -2,7 +2,7 @@ import React, { useCallback, useState } from 'react';
22import { Grid } from 'indigo-react';
33import * as ob from 'urbit-ob';
44
5−import NetworkingKeys from 'components/NetworkingKeys';
5+import NetworkKeys from 'components/NetworkKeys';
66import Window from 'components/L2/Window/Window';
77import HeaderPane from 'components/L2/Window/HeaderPane';
88import BodyPane from 'components/L2/Window/BodyPane';
@@ -30,9 +30,9 @@ export default function UrbitOSHome() {
3030 const toggleShowKeys = useCallback(() => setShowKeys(s => !s), [setShowKeys]);
3131
3232 // The initial key revision number is 0, and increments when set
33− const hasSetNetworkingKeys = point.keyRevisionNumber !== '0';
33+ const hasSetNetworkKeys = point.keyRevisionNumber !== '0';
3434
35− const goNetworkingKeys = useCallback(() => push(names.NETWORKING_KEYS), [
35+ const goNetworkKeys = useCallback(() => push(names.NETWORKING_KEYS), [
3636 names,
3737 push,
3838 ]);
@@ -49,10 +49,10 @@ export default function UrbitOSHome() {
4949 <HeaderPane>
5050 <Row className="header-row">
5151 <h5>OS</h5>
52− {hasSetNetworkingKeys && (
52+ {hasSetNetworkKeys && (
5353 <Button
5454 className="header-button keyfile"
55− disabled={!hasSetNetworkingKeys}
55+ disabled={!hasSetNetworkKeys}
5656 onClick={keyBind.download}>
5757 <KeyfileIcon />
5858 Download Keyfile
@@ -84,20 +84,20 @@ export default function UrbitOSHome() {
8484 <Box>Network Keys</Box>
8585 <Box
8686 className={`subtitle ${
87− !hasSetNetworkingKeys ? 'error-text' : ''
87+ !hasSetNetworkKeys ? 'error-text' : ''
8888 }`}>
89− {hasSetNetworkingKeys
89+ {hasSetNetworkKeys
9090 ? `Revision: ${point.keyRevisionNumber}`
9191 : 'No network keys found'}
9292 </Box>
9393 </Box>
9494 <Row>
9595 <Button
96− className={hasSetNetworkingKeys ? 'secondary' : 'primary'}
97− onClick={goNetworkingKeys}>
98− {hasSetNetworkingKeys ? 'Reset' : 'Initialize'}
96+ className={hasSetNetworkKeys ? 'secondary' : 'primary'}
97+ onClick={goNetworkKeys}>
98+ {hasSetNetworkKeys ? 'Reset' : 'Initialize'}
9999 </Button>
100− {hasSetNetworkingKeys && (
100+ {hasSetNetworkKeys && (
101101 <Button className="secondary" onClick={toggleShowKeys}>
102102 View
103103 </Button>
@@ -120,7 +120,7 @@ export default function UrbitOSHome() {
120120
121121 <Modal show={showKeys} hide={() => setShowKeys(false)}>
122122 <Box className="show-keys-modal-content">
123− <Grid.Item full as={NetworkingKeys} point={point.value} />
123+ <Grid.Item full as={NetworkKeys} point={point.value} />
124124 </Box>
125125 </Modal>
126126 </Window>
src/views/UrbitOS/NetworkingKeys.js → src/views/UrbitOS/NetworkKeys.jsrenamed+11−11
@@ -145,14 +145,14 @@ function useSetKeys(manualNetworkSeed, setManualNetworkSeed) {
145145 };
146146}
147147
148−export default function UrbitOSNetworkingKeys({
148+export default function UrbitOSNetworkKeys({
149149 manualNetworkSeed,
150150 setManualNetworkSeed,
151151}) {
152152 const { pop } = useLocalRouter();
153153 const { point, setLoading } = useRollerStore();
154154 const {
155− configureNetworkingKeys,
155+ configureNetworkKeys,
156156 getPendingTransactions,
157157 checkForUpdates,
158158 } = useRoller();
@@ -173,7 +173,7 @@ export default function UrbitOSNetworkingKeys({
173173 if (completed) {
174174 checkForUpdates(
175175 point.value,
176− `${point.patp}'s Networking Keys have been set!`
176+ `${point.patp}'s Network Keys have been set!`
177177 );
178178 }
179179 }, [completed]); // eslint-disable-line react-hooks/exhaustive-deps
@@ -219,10 +219,10 @@ export default function UrbitOSNetworkingKeys({
219219 [construct, unconstruct, setManualNetworkSeed, setBreach]
220220 );
221221
222− const setNetworkingKeys = useCallback(async () => {
222+ const setNetworkKeys = useCallback(async () => {
223223 setLoading(true);
224224 try {
225− await configureNetworkingKeys({
225+ await configureNetworkKeys({
226226 breach,
227227 manualNetworkSeed,
228228 });
@@ -237,7 +237,7 @@ export default function UrbitOSNetworkingKeys({
237237 //
238238 checkForUpdates(
239239 point.value,
240− `${point.patp}'s Networking Keys have been set!`
240+ `${point.patp}'s Network Keys have been set!`
241241 );
242242 pop();
243243 } catch (error) {
@@ -251,7 +251,7 @@ export default function UrbitOSNetworkingKeys({
251251 getPendingTransactions,
252252 point,
253253 pop,
254− configureNetworkingKeys,
254+ configureNetworkKeys,
255255 setLoading,
256256 checkForUpdates,
257257 ]);
@@ -266,7 +266,7 @@ export default function UrbitOSNetworkingKeys({
266266
267267 const viewTitle = completed
268268 ? 'Network Keys are now set'
269− : 'Set Networking Keys';
269+ : 'Set Network Keys';
270270
271271 const usageMessage =
272272 'You need this keyfile to authenticate with your OS. Please Download.';
@@ -350,15 +350,15 @@ export default function UrbitOSNetworkingKeys({
350350 className=""
351351 center
352352 solid
353− onClick={setNetworkingKeys}>
354− {'Reset Networking Keys'}
353+ onClick={setNetworkKeys}>
354+ {'Reset Network Keys'}
355355 </Grid.Item>
356356 ) : (
357357 <Grid.Item
358358 full
359359 as={InlineEthereumTransaction}
360360 {...bind}
361− label={`${hasKeys ? 'Reset' : 'Set'} Networking Keys`}
361+ label={`${hasKeys ? 'Reset' : 'Set'} Network Keys`}
362362 onReturn={() => pop()}
363363 />
364364 )}