<commit_before>import { uploadTSV, submitToServer, updateFileContent } from './actions';
import styled from 'styled-components';
import { connect } from 'react-redux';
import { button, UploadButton, SubmitButton, Required_Notification, Dropdown, Input, Label } from '../theme';
import React, {Component, PropTypes} from 'react';
import {json_to_string} from '../utils.js';
import {Toggle} from 'material-ui';


const Input_Description = styled.span`
	font-size: 1rem;
	display:inline-block;
	width: 750px;
`;


const UploadFormButton = styled.button`
  border: 1px solid darkgreen;
  display:inline-block;
  color: darkgreen;
  margin: 1em 0em;
  &:hover,
  &:active,
  &:focus {
    color: #2e842e;
    border-color: #2e842e;
  }
  border-radius: 3px;
  padding: 0px 8px;
  cursor: pointer;
  line-height: 2em;
  font-size: 1em;
  margin-right: 1em;
  background-color:white;
`;

const AnyOfSubProps = styled.div`
	margin-left:50px;
`;

const TextInput = ({name, value, required, description, onChange}) =>{
	return(
		<div>
			<Label htmlFor={name}> {name}: </Label>
			{description != '' && <Input_Description>{description}</Input_Description>}
			<br />
			<Input type="text" name={name} value={value ? value:""} onChange={onChange}/>
			{required && <Required_Notification> {"*"} </Required_Notification>}	
		</div>
	)
};

const StyledTextInput = styled(TextInput)`
	width:500px;
	height: 50px;
`;

class EnumInput extends Component {

	static propTypes = {
		name: PropTypes.string,
		options: PropTypes.array,
		required: PropTypes.bool,
		description: PropTypes.string,
		onChange: PropTypes.func,
	}

	state = {
		chosenEnum: ''
	}
	render(){
		let options = this.props.options.map( (option, i) => ({label:option, value:option}) );
		
		let onChangeEnumWrapper = (newValue) =>{
			this.setState({
				chosenEnum:newValue
			});<commit_msg>fix(submit_form): required for text inputs<commit_after>import { uploadTSV, submitToServer, updateFileContent } from './actions';
import styled from 'styled-components';
import { connect } from 'react-redux';
import { button, UploadButton, SubmitButton, Required_Notification, Dropdown, Input, Label } from '../theme';
import React, {Component, PropTypes} from 'react';
import {json_to_string} from '../utils.js';
import {Toggle} from 'material-ui';


const Input_Description = styled.span`
	font-size: 1rem;
	display:inline-block;
	width: 750px;
`;


const UploadFormButton = styled.button`
  border: 1px solid darkgreen;
  display:inline-block;
  color: darkgreen;
  margin: 1em 0em;
  &:hover,
  &:active,
  &:focus {
    color: #2e842e;
    border-color: #2e842e;
  }
  border-radius: 3px;
  padding: 0px 8px;
  cursor: pointer;
  line-height: 2em;
  font-size: 1em;
  margin-right: 1em;
  background-color:white;
`;

const AnyOfSubProps = styled.div`
	margin-left:50px;
`;

const TextInput = ({name, value, required, description, onChange}) =>{
	return(
		<div>
			<Label htmlFor={name}> {name}: </Label>
			{description != '' && <Input_Description>{description}</Input_Description>}
			<br />
			<Input type="text" name={name} value={value ? value:""} required onChange={onChange}/>
			{required && <Required_Notification> {"*"} </Required_Notification>}	
		</div>
	)
};

const StyledTextInput = styled(TextInput)`
	width:500px;
	height: 50px;
`;

class EnumInput extends Component {

	static propTypes = {
		name: PropTypes.string,
		options: PropTypes.array,
		required: PropTypes.bool,
		description: PropTypes.string,
		onChange: PropTypes.func,
	}

	state = {
		chosenEnum: ''
	}
	render(){
		let options = this.props.options.map( (option, i) => ({label:option, value:option}) );
		
		let onChangeEnumWrapper = (newValue) =>{
			this.setState({
				chosenEnum:newValue
			});
{'fraction_non_alphanumeric': 0.15184788430637386, 'fraction_numerical': 0.014997321906802356, 'mean_word_length': 4.492647058823529, 'pattern_counts': {'":': 0, '<': 23, '<?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': '4094664', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1266, 'n_words': 299}