<commit_before>import React, { Component } from 'react';
import './Form.css';
import { jsToAirtable } from '../../utils/mapColumns';

class Form extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };

    this.onSubmit = this.onSubmit.bind(this);
    this.onChange = this.onChange.bind(this);
  }

  onSubmit(ev) {
    ev.preventDefault();
    console.log('submit')
  }

  onChange(ev) {
    this.setState({
      [ev.target.name]: ev.target.value
    });
  }

  // TODO: figure out how to order the fields instead of them being random
  render() {
    return (
      <form className="Form" onSubmit={this.onSubmit}>
        {Object.keys(this.props.exhibitorData).map(field => {
          if (Array.isArray(this.props.exhibitorData[field])) {
            return (
              <div>
                <p>{jsToAirtable[field]}: </p>
                <select disabled='true' name={field} key={field}>
                {/* this doesn't work and I'm not sure why */}
                {this.props.exhibitorData[field].forEach(item => {
                  console.log(item);
                  return <option value={item} key={item}>{item}</option>;
                  }
                )}
                </select>
              </div><commit_msg>forEach -> map<commit_after>import React, { Component } from 'react';
import './Form.css';
import { jsToAirtable } from '../../utils/mapColumns';

class Form extends Component {
  constructor(props) {
    super(props);
    this.state = {
    };

    this.onSubmit = this.onSubmit.bind(this);
    this.onChange = this.onChange.bind(this);
  }

  onSubmit(ev) {
    ev.preventDefault();
    console.log('submit')
  }

  onChange(ev) {
    this.setState({
      [ev.target.name]: ev.target.value
    });
  }

  // TODO: figure out how to order the fields instead of them being random
  render() {
    return (
      <form className="Form" onSubmit={this.onSubmit}>
        {Object.keys(this.props.exhibitorData).map(field => {
          if (Array.isArray(this.props.exhibitorData[field])) {
            return (
              <div>
                <p>{jsToAirtable[field]}: </p>
                <select disabled='true' name={field} key={field}>
                {/* this doesn't work and I'm not sure why */}
                {this.props.exhibitorData[field].map(item => {
                  console.log(item);
                  return <option value={item} key={item}>{item}</option>;
                  }
                )}
                </select>
              </div>
{'fraction_non_alphanumeric': 0.15092848676412485, 'fraction_numerical': 0.0, 'mean_word_length': 1.9441860465116279, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 26, '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': '2856267', 'n_tokens_mistral': 766, 'n_tokens_neox': 739, 'n_words': 148}