on master help sign in
Merge pull request #130 from urbit/breach-flag
d21fe54Fang
src/bridge/components/CheckboxButton.js+3−1
@@ -16,7 +16,8 @@ const CheckboxButton = props => {
16 return (
16 return (
17 <div
17 <div
18 className={`flex items-center ${props.className}`}
18 className={`flex items-center ${props.className}`}
19− style={props.style}>
19+ style={{cursor: 'pointer', ...props.style}}
20+ onClick={props.onToggle}>
20
21
21 <ProtoButton
22 <ProtoButton
22 // {...getDomProps(props)}
23 // {...getDomProps(props)}
@@ -38,6 +39,7 @@ const CheckboxButton = props => {
38
39
39 </ProtoButton>
40 </ProtoButton>
40
41
42+ <div>{ props.label }</div>
41 { props.children }
43 { props.children }
42
44
43 </div>
45 </div>
src/bridge/components/StatelessTransaction.js+3−6
@@ -428,13 +428,10 @@ class StatelessTransaction extends React.Component {
428 <CheckboxButton
428 <CheckboxButton
429 className={ 'mt-8' }
429 className={ 'mt-8' }
430 disabled={ !canApprove }
430 disabled={ !canApprove }
431− onClick={ setUserApproval }
431+ onToggle={ setUserApproval }
432 state={ userApproval }
432 state={ userApproval }
433− >
434− <div onClick={ setUserApproval }>
435− { `I approve this transaction and wish to send.` }
433+ label='I approve this transaction and wish to send.'
436− </div>
437− </CheckboxButton>
434+ ></CheckboxButton>
438
435
439 const sendTxnButton =
436 const sendTxnButton =
440 <Button
437 <Button
src/bridge/views/SetKeys.js+17−8
@@ -2,7 +2,7 @@ import React from 'react'
2import Maybe from 'folktale/maybe'
2import Maybe from 'folktale/maybe'
3import * as azimuth from 'azimuth-js'
3import * as azimuth from 'azimuth-js'
4import * as ob from 'urbit-ob'
4import * 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'
6
6
7import StatelessTransaction from '../components/StatelessTransaction'
7import StatelessTransaction from '../components/StatelessTransaction'
8import { BRIDGE_ERROR } from '../lib/error'
8import { BRIDGE_ERROR } from '../lib/error'
@@ -33,15 +33,19 @@ class SetKeys extends React.Component {
33 nondeterministicSeed: false,
33 nondeterministicSeed: false,
34 point: point,
34 point: point,
35 cryptoSuiteVersion: 1,
35 cryptoSuiteVersion: 1,
36− continuity: false,
36+ discontinuity: false,
37 isManagementSeed: false,
37 isManagementSeed: false,
38 }
38 }
39
39
40− this.handleNetworkSeedInput = this.handleNetworkSeedInput.bind(this)
40+ this.toggleDiscontinuity = this.toggleDiscontinuity.bind(this);
41 // Transaction
41 // Transaction
42 this.createUnsignedTxn = this.createUnsignedTxn.bind(this)
42 this.createUnsignedTxn = this.createUnsignedTxn.bind(this)
43 }
43 }
44
44
45+ toggleDiscontinuity() {
46+ this.setState({ discontinuity: !this.state.discontinuity });
47+ }
48+
45 componentDidMount() {
49 componentDidMount() {
46 const { props } = this
50 const { props } = this
47
51
@@ -94,10 +98,6 @@ class SetKeys extends React.Component {
94 })
98 })
95 }
99 }
96
100
97− handleNetworkSeedInput(networkSeed) {
98− this.setState({ networkSeed })
99− }
100−
101 createUnsignedTxn() {
101 createUnsignedTxn() {
102 const { state, props } = this
102 const { state, props } = this
103
103
@@ -130,7 +130,7 @@ class SetKeys extends React.Component {
130 pencr,
130 pencr,
131 pauth,
131 pauth,
132 1,
132 1,
133− false
133+ state.discontinuity
134 )
134 )
135
135
136 return Maybe.Just(txn)
136 return Maybe.Just(txn)
@@ -185,6 +185,15 @@ class SetKeys extends React.Component {
185 </Warning>
185 </Warning>
186 : <div /> }
186 : <div /> }
187
187
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+
188 <StatelessTransaction
197 <StatelessTransaction
189 // Upper scope
198 // Upper scope
190 web3={props.web3}
199 web3={props.web3}