on master help sign in
- Add “download keyfile” button to the sentTransaction page if they just set networking keys
commitbdd3bc281a2fd63aaf327ad2cab932bb370c4e5d authorChris Johnson <chris@cjohnson.io> dateSun 31 Mar 2019, 21:06 (8 years ago) parent17b7424
3 files changed+33−4
src/Bridge.js+5−1 src/views/SentTransaction.js+26−1 src/views/SetKeys.js+2−2
src/Bridge.js+5−1
@@ -40,6 +40,7 @@ class Bridge extends React.Component {
4040 this.state = {
4141 // routes
4242 routeCrumbs: Stack([ ROUTE_NAMES.LANDING ]),
43+ routeData: {},
4344 // network
4445 networkType: networkType,
4546 web3: Maybe.Nothing(),
@@ -120,10 +121,11 @@ class Bridge extends React.Component {
120121 // }
121122}
122123
123− pushRoute(symbol) {
124+ pushRoute(symbol, routeData) {
124125 if (lodash.includes(ROUTE_NAMES, symbol)) {
125126 this.setState((state, _) => ({
126127 routeCrumbs: state.routeCrumbs.push(symbol),
128+ routeData: routeData
127129 }));
128130
129131 // Scroll to top of page with each route transition.
@@ -212,6 +214,7 @@ class Bridge extends React.Component {
212214 render() {
213215 const {
214216 routeCrumbs,
217+ routeData,
215218 networkType,
216219 walletType,
217220 walletHdPath,
@@ -246,6 +249,7 @@ class Bridge extends React.Component {
246249 // router
247250 pushRoute={ this.pushRoute }
248251 popRoute={ this.popRoute }
252+ routeData={ routeData }
249253 // network
250254 setNetworkType={ this.setNetworkType }
251255 setNetwork={ this.setNetwork }
src/views/SentTransaction.js+26−1
@@ -2,6 +2,7 @@ import React from 'react'
22import { Row, Col, H1, H3, P, Warning, Anchor } from '../components/Base'
33import { Button } from '../components/Base'
44
5+import { ROUTE_NAMES } from '../lib/router'
56import { BRIDGE_ERROR, renderTxnError } from '../lib/error'
67import { NETWORK_NAMES } from '../lib/network'
78
@@ -75,9 +76,11 @@ const Failure = (props) =>
7576 </Row>
7677
7778const SentTransaction = (props) => {
78− const { web3, txnHashCursor, networkType, popRoute } = props
79+ const { web3, txnHashCursor, networkType, popRoute, pushRoute } = props
7980 const { setPointCursor, pointCursor } = props
8081
82+ const promptKeyfile = props.routeData && props.routeData.promptKeyfile
83+
8184 const w3 = web3.matchWith({
8285 Nothing: _ => { throw BRIDGE_ERROR.MISSING_WEB3 },
8386 Just: res => res.value
@@ -113,10 +116,32 @@ const SentTransaction = (props) => {
113116 </Col>
114117 </Row>
115118
119+ let keyfile;
120+
121+ if (promptKeyfile) {
122+ keyfile = (
123+ <Row>
124+ <Col>
125+ <Button
126+ prop-type={'link'}
127+ onClick={
128+ () => {
129+ popRoute()
130+ pushRoute(ROUTE_NAMES.GEN_KEYFILE)
131+ }
132+ }>
133+ { 'Download Keyfile →' }
134+ </Button>
135+ </Col>
136+ </Row>
137+ )
138+ }
139+
116140 return (
117141 <div>
118142 { body }
119143 { ok }
144+ { keyfile }
120145 </div>
121146 )
122147}
src/views/SetKeys.js+2−2
@@ -270,7 +270,7 @@ class SetKeys extends React.Component {
270270 props.setNetworkSeedCache(this.state.networkSeed)
271271 props.setTxnHashCursor(sent)
272272 props.popRoute()
273− props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION)
273+ props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION, {promptKeyfile: true})
274274 })
275275 .catch(err => {
276276 this.setState({ txError: err.map(val => val.merge()) })
@@ -355,7 +355,7 @@ class SetKeys extends React.Component {
355355 <h3 className={'mb-2'}>{'Warning'}</h3>
356356 {
357357 `Your network seed could not be derived automatically. We've
358− generated a random one for you, but you must download your Arvo
358+ generated a random one for you, so you must download your Arvo
359359 keyfile during this session after setting your keys.`
360360 }
361361 </Warning>