on master help sign in
- Add “download keyfile” button to the sentTransaction page if they just set networking keys
bdd3bc2Chris Johnson
src/Bridge.js+5−1
@@ -40,6 +40,7 @@ class Bridge extends React.Component {
40 this.state = {
40 this.state = {
41 // routes
41 // routes
42 routeCrumbs: Stack([ ROUTE_NAMES.LANDING ]),
42 routeCrumbs: Stack([ ROUTE_NAMES.LANDING ]),
43+ routeData: {},
43 // network
44 // network
44 networkType: networkType,
45 networkType: networkType,
45 web3: Maybe.Nothing(),
46 web3: Maybe.Nothing(),
@@ -120,10 +121,11 @@ class Bridge extends React.Component {
120 // }
121 // }
121}
122}
122
123
123− pushRoute(symbol) {
124+ pushRoute(symbol, routeData) {
124 if (lodash.includes(ROUTE_NAMES, symbol)) {
125 if (lodash.includes(ROUTE_NAMES, symbol)) {
125 this.setState((state, _) => ({
126 this.setState((state, _) => ({
126 routeCrumbs: state.routeCrumbs.push(symbol),
127 routeCrumbs: state.routeCrumbs.push(symbol),
128+ routeData: routeData
127 }));
129 }));
128
130
129 // Scroll to top of page with each route transition.
131 // Scroll to top of page with each route transition.
@@ -212,6 +214,7 @@ class Bridge extends React.Component {
212 render() {
214 render() {
213 const {
215 const {
214 routeCrumbs,
216 routeCrumbs,
217+ routeData,
215 networkType,
218 networkType,
216 walletType,
219 walletType,
217 walletHdPath,
220 walletHdPath,
@@ -246,6 +249,7 @@ class Bridge extends React.Component {
246 // router
249 // router
247 pushRoute={ this.pushRoute }
250 pushRoute={ this.pushRoute }
248 popRoute={ this.popRoute }
251 popRoute={ this.popRoute }
252+ routeData={ routeData }
249 // network
253 // network
250 setNetworkType={ this.setNetworkType }
254 setNetworkType={ this.setNetworkType }
251 setNetwork={ this.setNetwork }
255 setNetwork={ this.setNetwork }
src/views/SentTransaction.js+26−1
@@ -2,6 +2,7 @@ import React from 'react'
2import { Row, Col, H1, H3, P, Warning, Anchor } from '../components/Base'
2import { Row, Col, H1, H3, P, Warning, Anchor } from '../components/Base'
3import { Button } from '../components/Base'
3import { Button } from '../components/Base'
4
4
5+import { ROUTE_NAMES } from '../lib/router'
5import { BRIDGE_ERROR, renderTxnError } from '../lib/error'
6import { BRIDGE_ERROR, renderTxnError } from '../lib/error'
6import { NETWORK_NAMES } from '../lib/network'
7import { NETWORK_NAMES } from '../lib/network'
7
8
@@ -75,9 +76,11 @@ const Failure = (props) =>
75 </Row>
76 </Row>
76
77
77const SentTransaction = (props) => {
78const SentTransaction = (props) => {
78− const { web3, txnHashCursor, networkType, popRoute } = props
79+ const { web3, txnHashCursor, networkType, popRoute, pushRoute } = props
79 const { setPointCursor, pointCursor } = props
80 const { setPointCursor, pointCursor } = props
80
81
82+ const promptKeyfile = props.routeData && props.routeData.promptKeyfile
83+
81 const w3 = web3.matchWith({
84 const w3 = web3.matchWith({
82 Nothing: _ => { throw BRIDGE_ERROR.MISSING_WEB3 },
85 Nothing: _ => { throw BRIDGE_ERROR.MISSING_WEB3 },
83 Just: res => res.value
86 Just: res => res.value
@@ -113,10 +116,32 @@ const SentTransaction = (props) => {
113 </Col>
116 </Col>
114 </Row>
117 </Row>
115
118
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+
116 return (
140 return (
117 <div>
141 <div>
118 { body }
142 { body }
119 { ok }
143 { ok }
144+ { keyfile }
120 </div>
145 </div>
121 )
146 )
122}
147}
src/views/SetKeys.js+2−2
@@ -270,7 +270,7 @@ class SetKeys extends React.Component {
270 props.setNetworkSeedCache(this.state.networkSeed)
270 props.setNetworkSeedCache(this.state.networkSeed)
271 props.setTxnHashCursor(sent)
271 props.setTxnHashCursor(sent)
272 props.popRoute()
272 props.popRoute()
273− props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION)
273+ props.pushRoute(ROUTE_NAMES.SENT_TRANSACTION, {promptKeyfile: true})
274 })
274 })
275 .catch(err => {
275 .catch(err => {
276 this.setState({ txError: err.map(val => val.merge()) })
276 this.setState({ txError: err.map(val => val.merge()) })
@@ -355,7 +355,7 @@ class SetKeys extends React.Component {
355 <h3 className={'mb-2'}>{'Warning'}</h3>
355 <h3 className={'mb-2'}>{'Warning'}</h3>
356 {
356 {
357 `Your network seed could not be derived automatically. We've
357 `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
359 keyfile during this session after setting your keys.`
359 keyfile during this session after setting your keys.`
360 }
360 }
361 </Warning>
361 </Warning>