<commit_before>// I'll come back to this
/* eslint-disable */
import React from 'react';
import Button from 'component/button';
import { Form, FormField, Submit } from 'component/common/form';

class UserEmailVerify extends React.PureComponent {
  constructor(props) {
    super(props);

    this.state = {
      code: '',
    };
  }

  handleCodeChanged(event) {
    this.setState({
      code: String(event.target.value).trim(),
    });
  }

  handleSubmit() {
    const { code } = this.state;
    try {
      const verification = JSON.parse(atob(code));
      this.props.verifyUserEmail(verification.token, verification.recaptcha);
    } catch (error) {
      this.props.verifyUserEmailFailure('Invalid Verification Token');
    }
  }

  render() {
    const { cancelButton, errorMessage, email, isPending } = this.props;
    // <FormField
    // label={__('Verification Code')}
    // errorMessage={errorMessage}
    // render{() => (
    //   <input
    //   name="code"
    //   value={this.state.code}
    //   onChange={event => {
    //     this.handleCodeChanged(event);
    //   }}
    //   />
    // )}
    // />
    return (
      <Form onSubmit={this.handleSubmit.bind(this)}>
        <p>Please enter the verification code emailed to {email}.</p>
        {/* render help separately so it always shows */}
        <div className="form-field__helper">
          <p>
            {__('Email')} <Button href="mailto:<EMAIL>" label="<EMAIL>" /> or join our{' '}
            <Button href="https://chat.lbry.io" label="chat" />{' '}
            {__('if you encounter any trouble with your code.')}
          </p>
        </div>
        <div className="form-row-submit">
          <Submit label={__('Verify')} disabled={isPending} />
          {cancelButton}
        </div>
      </Form>
    );
  }
}

export default UserEmailVerify;
/* eslint-enable */<commit_msg>fix: user email verify style<commit_after>// I'll come back to this
/* eslint-disable */
import React from 'react';
import Button from 'component/button';
import { Form, FormField, FormRow, Submit } from 'component/common/form';

class UserEmailVerify extends React.PureComponent {
  constructor(props) {
    super(props);

    this.state = {
      code: '',
    };

    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleCodeChanged(event) {
    this.setState({
      code: String(event.target.value).trim(),
    });
  }

  handleSubmit() {
    const { code } = this.state;
    try {
      const verification = JSON.parse(atob(code));
      this.props.verifyUserEmail(verification.token, verification.recaptcha);
    } catch (error) {
      this.props.verifyUserEmailFailure('Invalid Verification Token');
    }
  }

  render() {
    const { cancelButton, errorMessage, email, isPending } = this.props;

    return (
      <Form onSubmit={this.handleSubmit}>
        <p>Please enter the verification code emailed to {email}.</p>
        <FormRow>
          <FormField
            stretch
            name="code"
            type="text"
            placeholder="eyJyZWNhcHRjaGEiOiIw..."
            label={__('Verification Code')}
            error={errorMessage}
            value={this.state.code}
            onChange={event => this.handleCodeChanged(event)}
          />
        </FormRow>
        <div className="help">
          <p>
            {__('Email')} <Button button="link" href="mailto:<EMAIL>" label="<EMAIL>" />{' '}
            or join our <Button button="link" href="https://chat.lbry.io" label="chat" />{' '}
            {__('if you encounter any trouble with your code.')}
          </p>
        </div>
        <div className="card__actions">
          <Submit label={__('Verify')} disabled={isPending} />
          {cancelButton}
        </div>
      </Form>
    );
  }
}

export default UserEmailVerify;
/* eslint-enable */
{'fraction_non_alphanumeric': 0.1539064541416253, 'fraction_numerical': 0.0, 'mean_word_length': 2.3461538461538463, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 41, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3426752', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1147, 'n_words': 241}