Commit 5e7402e3 authored by Amaury Martiny's avatar Amaury Martiny

Use FetherForm in Signer page

parent eb1043f6
......@@ -18,30 +18,15 @@ import TokenBalance from '../../Tokens/TokensList/TokenBalance';
}))
@observer
class Signer extends Component {
state = {
error: null,
isSending: false,
password: ''
};
handleAccept = event => {
handleAccept = values => {
const { history, sendStore, token } = this.props;
const { password } = this.state;
event.preventDefault();
this.setState({ isSending: true }, () => {
sendStore
.send(password)
.then(() => history.push(`/send/${token.address}/sent`))
.catch(error => {
this.setState({ error, isSending: false });
});
});
};
handleChangePassword = ({ target: { value } }) => {
this.setState({ error: null, password: value });
return sendStore
.send(values.password)
.then(() => history.push(`/send/${token.address}/sent`))
.catch(error => ({
password: error
}));
};
render () {
......@@ -52,7 +37,7 @@ class Signer extends Component {
} = this.props;
if (!tx || !token) {
return <Redirect to={`/`} />;
return <Redirect to='/' />;
}
return (
......@@ -71,16 +56,20 @@ class Signer extends Component {
<TokenBalance
drawers={[
<div key='txForm'>
<div className='form_field'>
<label>Amount</label>
<div className='form_field_value'>
{tx.amount} {token.symbol}
</div>
</div>
<div className='form_field'>
<label>To</label>
<div className='form_field_value'>{tx.to}</div>
</div>
<FetherForm.Field
className='form_field_value'
disabled
defaultValue={`${tx.amount} ${token.symbol}`}
label='Amount'
/>
<FetherForm.Field
as='textarea'
className='form_field_value'
disabled
defaultValue={tx.to}
label='To'
/>
</div>,
<Form
key='signerForm'
......@@ -93,6 +82,7 @@ class Signer extends Component {
<Field
label='Password'
name='password'
render={FetherForm.Field}
required
type='password'
......
......@@ -14,6 +14,8 @@
}
.form_field_value {
background-color: transparent;
border: none;
font-size: ms(-1);
font-weight: 400;
font-family: $mono;
......@@ -21,6 +23,8 @@
opacity: 0.75;
margin: 0.25rem 0.5rem 0;
padding-bottom: 0.5rem;
padding-left: 0;
padding-right: 0;
overflow: hidden;
word-wrap: break-word;
}
......
......@@ -18,10 +18,10 @@ export const Field = ({
<div className='form_field'>
<label>{label}</label>
<Popup
content={meta.error}
content={meta && meta.error}
inverted
on='click'
open={!meta.pristine && !meta.valid && meta.touched}
open={meta && !meta.pristine && !meta.valid}
position='top center'
size='mini'
trigger={<T {...input} {...otherProps} />}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment