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, startTransactions } from 'lib/invite';
10import { useNetwork } from 'store/network';
11import { useWallet } from 'store/wallet';
12import { usePointCursor } from 'store/pointCursor';
13import useLifecycle from 'lib/useLifecycle';
15export default function DoReticket({ newWallet, completed }) {
16 const { web3, contracts } = useNetwork();
17 const { wallet, setUrbitWallet } = useWallet();
18 const { pointCursor } = usePointCursor();
20 const [transactionProgress, setTransactionProgress] = useState(
21 TRANSACTION_STATES.GENERATING
23 const [errors, setErrors] = useState([]);
25 // start reticketing transactions on mount
28 realPointM: pointCursor,
31 inviteWalletM: wallet,
32 realWalletM: Just(newWallet.value.wallet),
38 const updateProgress = notification => {
39 if (notification.type === 'progress') {
40 setTransactionProgress(notification.value);
41 } else if (notification.type === 'notify') {
42 setErrors([notification.value]);
50 const getErrors = () => {
51 if (errors.length === 0) return null;
53 let errorElems = errors.map(e => <span>{e}</span>);
57 <h3 className={'mb-2'}>{'Warning'}</h3>
63 const errorDisplay = getErrors();
68 {transactionProgress.label === TRANSACTION_STATES.DONE.label ? (
70 <h1 className="fs-6 lh-8 mb-3">
72 <span className="ml-4 green">✓</span>
74 <ForwardButton onClick={next}>Done!</ForwardButton>
78 <h1 className="fs-6 lh-8 mb-3">Submitting</h1>
79 <p className="mt-4 mb-4">
80 This step can take up to five minutes. Please do not leave this page
81 until the transactions are complete.
83 <div className="passport-progress mb-2">
85 className="passport-progress-filled"
86 style={{ width: transactionProgress.pct }}
89 <div className="flex justify-between">
90 <div className="text-mono text-sm lh-6 green-dark">
91 {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