on master help sign in
- Fix input sizes on urbit ticket page

- Add disabled state & loading spinner to ‘unlock wallet’ action

commit9d526e4eb3af97975a053c2495167ff3eaf8b6f5 authorChris Johnson <chris@cjohnson.io> dateThu 7 Mar 2019, 12:57 (8 years ago) parent09b86e8
2 files changed+27−10
src/style/input.css+7−7 src/views/Ticket.js+20−3
src/style/input.css+7−7
@@ -15,6 +15,13 @@ input:-webkit-autofill {
1515 -webkit-animation-fill-mode: both;
1616}
1717
18+input[prop-format*='innerLabel'] {
19+ padding-top: 8rem;
20+ height: 20rem;
21+ padding-left: 4rem;
22+ padding-right: 4rem;
23+}
24+
1825input[prop-size='lg'] {
1926 height: 18rem;
2027 font-size: 5rem;
@@ -36,13 +43,6 @@ input[prop-size='sm'] {
3643 padding-right: 1rem;
3744}
3845
39−input[prop-format*='innerLabel'] {
40− padding-top: 8rem;
41− height: 20rem;
42− padding-left: 4rem;
43− padding-right: 4rem;
44−}
45−
4646input[prop-format*='innerLabel'][prop-size='md'] {
4747 height: 16rem;
4848 font-size: 4rem;
src/views/Ticket.js+20−3
@@ -25,7 +25,8 @@ class Ticket extends React.Component {
2525
2626 this.state = {
2727 ticket: '',
28− pointName: ''
28+ pointName: '',
29+ isUnlocking: false
2930 }
3031
3132 this.pointPlaceholder = placeholder(4)
@@ -53,6 +54,11 @@ class Ticket extends React.Component {
5354
5455 async walletFromTicket(ticket, pointName) {
5556 const { setWallet, setUrbitWallet } = this.props
57+
58+ this.setState({
59+ isUnlocking: true
60+ });
61+
5662 const urbitWallet = await kg.generateWallet({
5763 ticket: ticket,
5864 ship: ob.patp2dec(pointName)
@@ -61,6 +67,10 @@ class Ticket extends React.Component {
6167 const wallet = walletFromMnemonic(mnemonic, DEFAULT_HD_PATH)
6268 setWallet(wallet)
6369 setUrbitWallet(Maybe.Just(urbitWallet))
70+
71+ this.setState({
72+ isUnlocking: false
73+ });
6474 }
6575
6676 render() {
@@ -99,7 +109,7 @@ class Ticket extends React.Component {
99109
100110 <TicketInput
101111 className='mono mt-8'
102− prop-size='md'
112+ prop-size='lg'
103113 prop-format='innerLabel'
104114 type='text'
105115 name='ticket'
@@ -112,9 +122,16 @@ class Ticket extends React.Component {
112122 <Button
113123 className={'mt-8'}
114124 prop-size={'lg wide'}
125+ disabled={this.state.isUnlocking || !Maybe.Nothing.hasInstance(wallet)}
115126 // prop-color={this.buttonTriState(wallet)}
116127 onClick={() => this.walletFromTicket(ticket, pointName)}>
117− {'Unlock Wallet →'}
128+
129+ <span className="relative">
130+ {this.state.isUnlocking &&
131+ <span className="btn-spinner"></span>
132+ }
133+ {'Unlock Wallet →'}
134+ </span>
118135 </Button>
119136
120137 <Button