on master help sign in
update-invites: adding alert and updated copy
commit6ef450ff9823fe7a01682bd1d32ab625259d6b62 authorHunter Miller <hunter@hmiller.dev> dateSun 6 Mar 2022, 15:55 (5 years ago) parent1d31d97
6 files changed+70−13
src/components/L2/CreatingInvitesModal.tsx+5−5 src/components/L2/Headers/L2PointHeader.scss+1−1 src/components/L2/InviteConverter.tsx+12−6 src/components/alerts/L2VulnAlert.tsx+49 src/views/Invite/useInvites.ts+1−1 src/views/Points.tsx+2
src/components/L2/CreatingInvitesModal.tsx+5−5
@@ -4,7 +4,7 @@ import { ReactComponent as InviteIcon } from 'assets/invite.svg';
44import { InviteGeneratingStatus } from '../../views/Invite/useInvites';
55import BodyPane from './Window/BodyPane';
66
7−interface GeneratingModalProps {
7+interface CreatingInvitesModalProps {
88 status: InviteGeneratingStatus;
99 current: number;
1010 total: number;
@@ -18,7 +18,7 @@ export const CreatingInvitesModal = ({
1818 total,
1919 hide,
2020 error,
21−}: GeneratingModalProps) => {
21+}: CreatingInvitesModalProps) => {
2222 const successfulInvites = current > 1 ? current - 1 : 0;
2323 return (
2424 <Modal
@@ -32,7 +32,7 @@ export const CreatingInvitesModal = ({
3232 <Row alignItems="center">
3333 <LoadingSpinner dark />
3434 <Text bold marginLeft={2}>
35− Creating Invite {current}/{total}...
35+ Updating Invite {current}/{total}...
3636 </Text>
3737 </Row>
3838 )}
@@ -41,7 +41,7 @@ export const CreatingInvitesModal = ({
4141 <Row mb={3}>
4242 <InviteIcon />
4343 <Text bold ml={2}>
44− All Invites Created
44+ All Invites Updated
4545 </Text>
4646 </Row>
4747 <Text mb={3}>
@@ -58,7 +58,7 @@ export const CreatingInvitesModal = ({
5858 {status === 'errored' && (
5959 <>
6060 <H3 marginBottom={2}>
61− There was an error while creating your invites:
61+ There was an error while updating your invites:
6262 </H3>
6363 {error && (
6464 <Text color="red" mono marginBottom={3}>
src/components/L2/Headers/L2PointHeader.scss+1−1
@@ -52,7 +52,7 @@
5252 }
5353
5454 .create-invites {
55− margin-left: 4px;
55+ margin-left: 8px;
5656 }
5757
5858 .invites {
src/components/L2/InviteConverter.tsx+12−6
@@ -20,6 +20,8 @@ import {
2020} from 'views/Invite/useInvites';
2121import { usePointCache } from 'store/pointCache';
2222import { CreatingInvitesModal } from './CreatingInvitesModal';
23+import { useWallet } from 'store/wallet';
24+import { WALLET_TYPES } from 'lib/constants';
2325
2426interface StarMap {
2527 [key: string]: {
@@ -52,6 +54,9 @@ function allChildrenSelected(selected: string[], childrenPatps: string[]) {
5254
5355export const InviteConverter = ({ points }: InviteConverterProps) => {
5456 const { syncControlledPoints }: any = usePointCache();
57+ const { walletType }: any = useWallet();
58+ const signatureFree =
59+ walletType === WALLET_TYPES.TICKET || walletType === WALLET_TYPES.SHARDS;
5560 const { api, getPendingTransactions, getAndUpdatePoint } = useRoller();
5661 const { inviteJobs } = useInviteStore();
5762 const { generateInviteCodes } = useInvites();
@@ -134,7 +139,6 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
134139
135140 try {
136141 for (const { point, children } of Object.values(starMap)) {
137− debugger;
138142 const filtered = children
139143 .filter(p => selected.includes(p.patp))
140144 .map(p => p.value);
@@ -201,7 +205,7 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
201205 {/*
202206 @ts-ignore */}
203207 <Button className="create-invites" center onClick={() => setShow(true)}>
204− Create Invites from Planets
208+ Update Invites
205209 </Button>
206210 <Modal small show={show} hide={() => setShow(false)}>
207211 <BodyPane p={0}>
@@ -209,7 +213,7 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
209213 <Row alignItems="center" mb={3}>
210214 <InviteIcon />
211215 <Text bold ml={2}>
212− Create Invites for Existing Planets
216+ Updates invites for planets
213217 </Text>
214218 </Row>
215219 <Text mb={5}>
@@ -220,9 +224,11 @@ export const InviteConverter = ({ points }: InviteConverterProps) => {
220224 keys invalid.
221225 </Text>
222226 </Text>
223− <Text bold className={!!signatureCount ? '' : 'hidden'}>
224− {signatureCount} manual signatures will be required.
225− </Text>
227+ {!signatureFree && (
228+ <Text bold className={!!signatureCount ? '' : 'hidden'}>
229+ {signatureCount} manual signatures will be required.
230+ </Text>
231+ )}
226232 <Col
227233 bg="washedGray"
228234 height="300px"
src/components/alerts/L2VulnAlert.tsxnew file+49
@@ -0,0 +1,49 @@
1+import { Anchor, BaseButton, Box, Col, Text } from '@tlon/indigo-react';
2+import useLocalStorageState from 'lib/useLocalStorageState';
3+
4+const L2_VULN_KEY = 'l2vuln-2022-03-07';
5+
6+export const L2VulnAlert = () => {
7+ const [showAlert, setShowAlert] = useLocalStorageState(L2_VULN_KEY, true);
8+
9+ if (!showAlert) {
10+ return null;
11+ }
12+
13+ return (
14+ <Box
15+ position="relative"
16+ p={3}
17+ mb={3}
18+ bg="washedBlue"
19+ borderWidth="1px"
20+ borderColor="lightBlue"
21+ borderStyle="solid"
22+ borderRadius={3}>
23+ <Col>
24+ <BaseButton
25+ position="absolute"
26+ top="3px"
27+ right="8px"
28+ fontSize="18px"
29+ fontWeight="200"
30+ cursor="pointer"
31+ bg="transparent"
32+ onClick={() => setShowAlert(false)}>
33+ &#215;
34+ </BaseButton>
35+ <Text bold mb={2}>
36+ ~2022.03.07 - L2 Planet invite fix
37+ </Text>
38+ <Text mb={2}>
39+ Due to an L2 security vulnerability, we strongly recommend you use the
40+ "Update Invites" button to rekey any L2 planet invites that were
41+ previously yet to be claimed.
42+ </Text>
43+ <Anchor href="https://urbit.org" target="_blank">
44+ Learn More About This Issue
45+ </Anchor>
46+ </Col>
47+ </Box>
48+ );
49+};
src/views/Invite/useInvites.ts+1−1
@@ -255,7 +255,7 @@ export function useInvites() {
255255 );
256256
257257 if (!spawn) {
258− performL2Reticket({
258+ await performL2Reticket({
259259 point: planet,
260260 to: inviteWallet.ownership.keys.address,
261261 manager: inviteWallet.management.keys.address,
src/views/Points.tsx+2
@@ -34,6 +34,7 @@ import './Points.scss';
3434import { StarReleaseButton } from './Points/StarReleaseButton';
3535import { maybeGetResult } from 'lib/maybeGetResult';
3636import { isGalaxy, isStar } from 'lib/utils/point';
37+import { L2VulnAlert } from 'components/alerts/L2VulnAlert';
3738
3839export const isLocked = (details: any, contracts: any) =>
3940 details.owner === contracts.linearSR ||
@@ -270,6 +271,7 @@ export default function Points() {
270271 {abbreviateAddress(address)}
271272 </CopiableAddress>
272273 </NavHeader>
274+ <L2VulnAlert />
273275 {incomingPoints.map(({ value }) => (
274276 <IncomingPoint
275277 key={value}