<commit_before>/*
 *
 * The PostRegForm Component is displayed within
 * the PostRegPage container.
 */

// React
import React from 'react';

// Styling
import styles from './styles.scss';

// Misc constants
import * as c from './constants';

// Dynamic form objects
import stateDeadlines from './state_deadlines';
import onlineRegForms from './online_registration_forms';
import messages from './messages';
import pollingPlaceLinks from './polling_place_links';

export class PostRegForm extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      registration: 'registered',
    };
  }

  getMailInDate(state) {
    // change to grab proper default state?
    if (!stateDeadlines[state]) {
      return c.MAIL_IN_DATE;
    }
    return stateDeadlines[state];
  }

  getRegInstructions(regState, stateAbbreviation) {
    const pollingPlaceLink = pollingPlaceLinks[stateAbbreviation];
    const onlineLink = onlineRegForms[stateAbbreviation];
    let onlineRegButton;

    if (onlineLink) {
      onlineRegButton = (<button
        className={styles.button}
        onClick={function() { window.location.href = onlineLink; }}
      >
        {messages.unregistered.online}
      </button>);
    }

    switch (regState) {
      case 'registered':
        return (
          <div>
            <button
              className={styles.button}
              onClick={function() { window.location.href = pollingPlaceLink; }}
            >
              {messages.registered.cta}
            </button>
          </div>
        );
      default:

        return (
          <div>
            <h3 className={styles.subHead}>Register to vote by <b>{this.getMailInDate(stateAbbreviation)}</b></h3>
            <button className={styles.button}>
              {messages.unregistered.mail}
            </button>
            {onlineRegButton}
          </div>
        );
    }
  }

  buildPostRegForm(regState, stateAbbreviation) {
    return (
      <div className={styles.postRegForm}>
        <div className={styles.header}>
          You are {regState} to vote <span className={styles.voteDay}>on <b>Nov 8</b></span>
        </div>
        <div className={styles.regInstructions}>
          {this.getRegInstructions(regState, stateAbbreviation)}
        </div>
      </div>
    );
  }

  render() {
    return this.buildPostRegForm(this.props.registered, this.props.state);
  }
}

PostRegForm.propTypes = {
  registered: React.PropTypes.string,
  state: React.PropTypes.string,
};

export default PostRegForm;
<commit_msg>Made the buttons links<commit_after>/*
 *
 * The PostRegForm Component is displayed within
 * the PostRegPage container.
 */

// React
import React from 'react';

// Styling
import styles from './styles.scss';

// Misc constants
import * as c from './constants';

// Dynamic form objects
import stateDeadlines from './state_deadlines';
import onlineRegForms from './online_registration_forms';
import messages from './messages';
import pollingPlaceLinks from './polling_place_links';

export class PostRegForm extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      registration: 'registered',
    };
  }

  getMailInDate(state) {
    // change to grab proper default state?
    if (!stateDeadlines[state]) {
      return c.MAIL_IN_DATE;
    }
    return stateDeadlines[state];
  }

  getRegInstructions(regState, stateAbbreviation) {
    const pollingPlaceLink = pollingPlaceLinks[stateAbbreviation];
    const onlineLink = onlineRegForms[stateAbbreviation];
    let onlineRegButton;

    if (onlineLink) {
      onlineRegButton = (
        <div>
          <a href={onlineLink}>
          <button className={styles.button}>
            {messages.unregistered.online}
          </button>
          </a>
        </div>);
    }

    switch (regState) {
      case 'registered':
        return (
          <div>
            <a href={pollingPlaceLink}>
            <button className={styles.button}>
              {messages.registered.cta}
            </button>
            </a>
          </div>
        );
      default:

        return (
          <div>
            <h3 className={styles.subHead}>Register to vote by <b>{this.getMailInDate(stateAbbreviation)}</b></h3>
            <button className={styles.button}>
              {messages.unregistered.mail}
            </button>
            {onlineRegButton}
          </div>
        );
    }
  }

  buildPostRegForm(regState, stateAbbreviation) {
    return (
      <div className={styles.postRegForm}>
        <div className={styles.header}>
          You are {regState} to vote <span className={styles.voteDay}>on <b>Nov 8</b></span>
        </div>
        <div className={styles.regInstructions}>
          {this.getRegInstructions(regState, stateAbbreviation)}
        </div>
      </div>
    );
  }

  render() {
    return this.buildPostRegForm(this.props.registered, this.props.state);
  }
}

PostRegForm.propTypes = {
  registered: React.PropTypes.string,
  state: React.PropTypes.string,
};

export default PostRegForm;

{'fraction_non_alphanumeric': 0.1198893936401343, 'fraction_numerical': 0.0011850681414181316, 'mean_word_length': 2.4448979591836735, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, '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': '3933921', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1439, 'n_words': 311}