lbry-desktop/src/renderer/component/userPhoneVerify/view.jsx

75 lines
1.9 KiB
React
Raw Normal View History

2018-03-26 23:32:43 +02:00
// I'll come back to this
/* eslint-disable */
import React from 'react';
2018-03-26 23:32:43 +02:00
import Button from 'component/button';
import { Form, FormElement, Submit } from 'component/common/form';
2017-06-03 01:09:52 +02:00
class UserPhoneVerify extends React.PureComponent {
2017-06-03 01:09:52 +02:00
constructor(props) {
super(props);
this.state = {
code: '',
2017-06-03 01:09:52 +02:00
};
}
handleCodeChanged(event) {
this.setState({
2017-07-19 01:00:13 +02:00
code: String(event.target.value).trim(),
2017-06-03 01:09:52 +02:00
});
}
handleSubmit() {
const { code } = this.state;
this.props.verifyUserPhone(code);
2017-06-03 01:09:52 +02:00
}
reset() {
const { resetPhone } = this.props;
resetPhone();
}
2017-06-03 01:09:52 +02:00
render() {
const { cancelButton, phoneErrorMessage, phone, countryCode } = this.props;
2017-06-08 23:15:34 +02:00
return (
<Form onSubmit={this.handleSubmit.bind(this)}>
2018-01-18 06:09:08 +01:00
<p>
{__(
2018-03-09 08:06:15 +01:00
`Please enter the verification code sent to +${countryCode}${phone}. Didn't receive it? `
)}
2018-03-26 23:32:43 +02:00
<Button onClick={this.reset.bind(this)} label="Go back." />
2018-01-18 06:09:08 +01:00
</p>
2018-03-26 23:32:43 +02:00
<FormElement
label={__('Verification Code')}
errorMessage={phoneErrorMessage}
2018-03-26 23:32:43 +02:00
render={() => (
<input
type="text"
name="code"
value={this.state.code}
onChange={event => {
this.handleCodeChanged(event);
}}
/>
)}
2017-06-08 23:15:34 +02:00
/>
{/* render help separately so it always shows */}
<div className="form-field__helper">
<p>
2018-03-26 23:32:43 +02:00
{__('Email')} <Button href="mailto:help@lbry.io" label="help@lbry.io" /> or join our{' '}
<Button href="https://chat.lbry.io" label="chat" />{' '}
{__('if you encounter any trouble with your code.')}
2017-06-08 23:15:34 +02:00
</p>
</div>
<div className="form-row-submit">
<Submit label={__('Verify')} />
{cancelButton}
2017-06-08 23:15:34 +02:00
</div>
</Form>
2017-06-08 23:15:34 +02:00
);
2017-06-03 01:09:52 +02:00
}
}
export default UserPhoneVerify;
2018-03-26 23:32:43 +02:00
/* eslint-enable */