on master help sign in
Merge pull request #130 from urbit/breach-flag

Support flagging for discontinuity

commitd21fe549d35c9f63de85f5f014be50a57d9fa3e7 authorFang <Fang-@users.noreply.github.com> dateWed 15 May 2019, 21:42 (7 years ago) parentfc3f5a841e354b
3 files changed+23−15
src/bridge/components/CheckboxButton.js+3−1 src/bridge/components/StatelessTransaction.js+3−6 src/bridge/views/SetKeys.js+17−8
src/bridge/components/CheckboxButton.js+3−1
@@ -16,7 +16,8 @@ const CheckboxButton = props => {
1616 return (
1717 <div
1818 className={`flex items-center ${props.className}`}
19− style={props.style}>
19+ style={{cursor: 'pointer', ...props.style}}
20+ onClick={props.onToggle}>
2021
2122 <ProtoButton
2223 // {...getDomProps(props)}
@@ -38,6 +39,7 @@ const CheckboxButton = props => {
3839
3940 </ProtoButton>
4041
42+ <div>{ props.label }</div>
4143 { props.children }
4244
4345 </div>
src/bridge/components/StatelessTransaction.js+3−6
@@ -428,13 +428,10 @@ class StatelessTransaction extends React.Component {
428428 <CheckboxButton
429429 className={ 'mt-8' }
430430 disabled={ !canApprove }
431− onClick={ setUserApproval }
431+ onToggle={ setUserApproval }
432432 state={ userApproval }
433− >
434− <div onClick={ setUserApproval }>
435− { `I approve this transaction and wish to send.` }
436− </div>
437− </CheckboxButton>
433+ label='I approve this transaction and wish to send.'
434+ ></CheckboxButton>
438435
439436 const sendTxnButton =
440437 <Button
src/bridge/views/SetKeys.js+17−8
@@ -2,7 +2,7 @@ import React from 'react'
22import Maybe from 'folktale/maybe'
33import * as azimuth from 'azimuth-js'
44import * as ob from 'urbit-ob'
5−import { Row, Col, H1, P, Warning } from '../components/Base'
5+import { Row, Col, H1, P, Warning, CheckboxButton } from '../components/Base'
66
77import StatelessTransaction from '../components/StatelessTransaction'
88import { BRIDGE_ERROR } from '../lib/error'
@@ -33,15 +33,19 @@ class SetKeys extends React.Component {
3333 nondeterministicSeed: false,
3434 point: point,
3535 cryptoSuiteVersion: 1,
36− continuity: false,
36+ discontinuity: false,
3737 isManagementSeed: false,
3838 }
3939
40− this.handleNetworkSeedInput = this.handleNetworkSeedInput.bind(this)
40+ this.toggleDiscontinuity = this.toggleDiscontinuity.bind(this);
4141 // Transaction
4242 this.createUnsignedTxn = this.createUnsignedTxn.bind(this)
4343 }
4444
45+ toggleDiscontinuity() {
46+ this.setState({ discontinuity: !this.state.discontinuity });
47+ }
48+
4549 componentDidMount() {
4650 const { props } = this
4751
@@ -94,10 +98,6 @@ class SetKeys extends React.Component {
9498 })
9599 }
96100
97− handleNetworkSeedInput(networkSeed) {
98− this.setState({ networkSeed })
99− }
100−
101101 createUnsignedTxn() {
102102 const { state, props } = this
103103
@@ -130,7 +130,7 @@ class SetKeys extends React.Component {
130130 pencr,
131131 pauth,
132132 1,
133− false
133+ state.discontinuity
134134 )
135135
136136 return Maybe.Just(txn)
@@ -185,6 +185,15 @@ class SetKeys extends React.Component {
185185 </Warning>
186186 : <div /> }
187187
188+ <CheckboxButton
189+ className='mt-8'
190+ onToggle={ this.toggleDiscontinuity }
191+ state={ state.discontinuity }
192+ label={`I have lost important off-chain data relating to this point
193+ and need to do a hard reset.
194+ (For example, rebooting an Arvo ship.)`}
195+ ></CheckboxButton>
196+
188197 <StatelessTransaction
189198 // Upper scope
190199 web3={props.web3}