1import React, { useState } from 'react';
2import { Just } from 'folktale/maybe';
4import View from 'components/View';
5import { ForwardButton } from 'components/Buttons';
6import { Warning } from 'components/old/Base';
8import { TRANSACTION_STATES, claimPointFromInvite } from 'lib/invite';
10import * as need from 'lib/need';
11import { useNetwork } from 'store/network';
12import { useWallet } from 'store/wallet';
13import { usePointCursor } from 'store/pointCursor';
14import useLifecycle from 'lib/useLifecycle';
16export default function DoReticket({ newWallet, completed }) {
17 const { web3, contracts } = useNetwork();
18 const { wallet, setUrbitWallet } = useWallet();
19 const { pointCursor } = usePointCursor();
21 const [transactionProgress, setTransactionProgress] = useState(
22 TRANSACTION_STATES.GENERATING
24 const [errors, setErrors] = useState([]);
26 // start reticketing transactions on mount
28 claimPointFromInvite({
29 inviteWallet: need.wallet(wallet),
30 wallet: newWallet.value.wallet,
31 point: need.point(pointCursor),
32 web3: need.web3(web3),
33 contracts: need.contracts(contracts),
34 onUpdate: updateProgress,
36 setUrbitWallet(newWallet.value.wallet);
40 const updateProgress = notification => {
41 if (notification.type === 'progress') {
42 setTransactionProgress(notification.value);
43 } else if (notification.type === 'notify') {
44 setErrors([notification.value]);
52 const getErrors = () => {
53 if (errors.length === 0) return null;
55 let errorElems = errors.map(e => <span>{e}</span>);
59 <h3 className={'mb-2'}>{'Warning'}</h3>
65 const errorDisplay = getErrors();
70 {transactionProgress.label === TRANSACTION_STATES.DONE.label ? (
72 <h1 className="fs-6 lh-8 mb-3">
74 <span className="ml-4 green">✓</span>
76 <ForwardButton onClick={next}>Done!</ForwardButton>
80 <h1 className="fs-6 lh-8 mb-3">Submitting</h1>
81 <p className="mt-4 mb-4">
82 This step can take up to five minutes. Please do not leave this page
83 until the transactions are complete.
85 <div className="passport-progress mb-2">
87 className="passport-progress-filled"
88 style={{ width: transactionProgress.pct }}
91 <div className="flex justify-between">
92 <div className="text-mono text-sm lh-6 green-dark">
93 {transactionProgress.label}
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