<commit_before>/*
 * Copyright 2012-present, Polis Technology Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights for non-commercial use can be found in the PATENTS file
 * in the same directory.
 */


import React from "react";
import Radium from "radium";
import Awesome from "react-fontawesome";
import StaticContentContainer from "./framework/static-content-container";
import Button from "./framework/generic-button";

import PolisNet from "../util/net";

// import _ from "lodash";
import Flex from "./framework/flex";
import { connect } from "react-redux";
import { handleContribSubmit } from "../actions";

@connect(state => state.contrib)
@Radium
class ComponentName extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      submitError: false,
      submitSuccess: false,
    };
  }
  static propTypes = {
    /* react */
    // dispatch: React.PropTypes.func,
    params: React.PropTypes.object,
    routes: React.PropTypes.array,
    /* component api */
    style: React.PropTypes.object,
    // foo: React.PropTypes.string
  }
  static defaultProps = {
    // foo: "bar"
  }
  getStyles() {
    return {
      base: {

      },
      input: {
        display: "block",
        margin: "10px 0px",
        color: "rgb(100,100,100)",
        width: "40%",
        fontSize: 14,
        padding: 7,
        borderRadius: 3,
        border: "1px solid rgb(130,130,130)",
      },
      heading: {
        fontSize: 36,
        display: "block",
        marginBottom: 20,
        marginTop: 0
      },
      card: {
        position: "relative",
        zIndex: 10,
        maxWidth: 600,
        padding: 20,
        borderRadius: 3,
        color: "rgb(130,130,130)"
      },
      button: {
        display: "block",
        backgroundColor: "#03a9f4",
        color: "white"
      },
      agreement: {
        width: 600,
        height: 150,
        borderRadius: 3,
        border: "1px solid rgb(130,130,130)",
        resize: "none",
        padding: "0px 20px 20px 20px",
        color: "rgb(100,100,100)",
        fontFamily: "Georgia, serif",
        marginBottom: 20,
      }
    };
  }
  handleSubmit () {
    const data = {
      name: this.refs.name.value,
      email: this.refs.email.value,
      github_id: this.refs.github_username.value,
      name: this.refs.name.value,
      company_name: this.refs.company_name.value,
      date: this.refs.date.value,
      agreement_version: 1,
    };

    PolisNet.polisPost("/api/v3/contributors", data)
      .then(() => {
        this.setState({
          submitSuccess: true,
          submitError: false
        })
      })
      .catch(() => {
        this.setState({
          submitSuccess: false,
          submitError: true
        })
      });

  }
  render() {
    const styles = this.getStyles();
    return (
      <StaticContentContainer
        backgroundColor={"#03a9f4"}
        headerBackgroundColor={"#03a9f4"}
        footerBackgroundColor={"#03a9f4"}
        image={false}>
        <Flex>
          <div style={styles.card}>
            <p style={styles.heading}>
              <Awesome name={"code"} /> Pol.is Contributor Agreement
            </p>
            <p>
              {`
                You are welcome to fork and hack on any pol.is repository.
                If you want to contribute back to our company's repositories, you'll need
                to complete the Contributor Agreement below.
                You only need to complete this form once to contribute to all pol.is repositories.
              `}
            </p>
            <Flex
              wrap="wrap"
              justifyContent="space-between">
              <input
                style={styles.input}
                type="text"
                placeholder="Name"
                ref="name"/>
              <input<commit_msg>.catch to .then<commit_after>/*
 * Copyright 2012-present, Polis Technology Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights for non-commercial use can be found in the PATENTS file
 * in the same directory.
 */


import React from "react";
import Radium from "radium";
import Awesome from "react-fontawesome";
import StaticContentContainer from "./framework/static-content-container";
import Button from "./framework/generic-button";

import PolisNet from "../util/net";

// import _ from "lodash";
import Flex from "./framework/flex";
import { connect } from "react-redux";
import { handleContribSubmit } from "../actions";

@connect(state => state.contrib)
@Radium
class ComponentName extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      submitError: false,
      submitSuccess: false,
    };
  }
  static propTypes = {
    /* react */
    // dispatch: React.PropTypes.func,
    params: React.PropTypes.object,
    routes: React.PropTypes.array,
    /* component api */
    style: React.PropTypes.object,
    // foo: React.PropTypes.string
  }
  static defaultProps = {
    // foo: "bar"
  }
  getStyles() {
    return {
      base: {

      },
      input: {
        display: "block",
        margin: "10px 0px",
        color: "rgb(100,100,100)",
        width: "40%",
        fontSize: 14,
        padding: 7,
        borderRadius: 3,
        border: "1px solid rgb(130,130,130)",
      },
      heading: {
        fontSize: 36,
        display: "block",
        marginBottom: 20,
        marginTop: 0
      },
      card: {
        position: "relative",
        zIndex: 10,
        maxWidth: 600,
        padding: 20,
        borderRadius: 3,
        color: "rgb(130,130,130)"
      },
      button: {
        display: "block",
        backgroundColor: "#03a9f4",
        color: "white"
      },
      agreement: {
        width: 600,
        height: 150,
        borderRadius: 3,
        border: "1px solid rgb(130,130,130)",
        resize: "none",
        padding: "0px 20px 20px 20px",
        color: "rgb(100,100,100)",
        fontFamily: "Georgia, serif",
        marginBottom: 20,
      }
    };
  }
  handleSubmit () {
    const data = {
      name: this.refs.name.value,
      email: this.refs.email.value,
      github_id: this.refs.github_username.value,
      name: this.refs.name.value,
      company_name: this.refs.company_name.value,
      date: this.refs.date.value,
      agreement_version: 1,
    };

    PolisNet.polisPost("/api/v3/contributors", data)
      .then(() => {
        this.setState({
          submitSuccess: true,
          submitError: false
        })
      }, () => {
        this.setState({
          submitSuccess: false,
          submitError: true
        })
      });
  }
  render() {
    const styles = this.getStyles();
    return (
      <StaticContentContainer
        backgroundColor={"#03a9f4"}
        headerBackgroundColor={"#03a9f4"}
        footerBackgroundColor={"#03a9f4"}
        image={false}>
        <Flex>
          <div style={styles.card}>
            <p style={styles.heading}>
              <Awesome name={"code"} /> Pol.is Contributor Agreement
            </p>
            <p>
              {`
                You are welcome to fork and hack on any pol.is repository.
                If you want to contribute back to our company's repositories, you'll need
                to complete the Contributor Agreement below.
                You only need to complete this form once to contribute to all pol.is repositories.
              `}
            </p>
            <Flex
              wrap="wrap"
              justifyContent="space-between">
              <input
                style={styles.input}
                type="text"
                placeholder="Name"
                ref="name"/>
              <input
{'fraction_non_alphanumeric': 0.11869510664993727, 'fraction_numerical': 0.026850690087829362, 'mean_word_length': 1.8807372605710155, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 29, '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': '946865', 'n_tokens_mistral': 2477, 'n_tokens_neox': 2259, 'n_words': 612}