<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import Input from '../common/input';

export const FIELDS = {
  oauth_key: 'Canvas Developer ID',
  oauth_secret: 'Canvas Developer Key',
  url: 'Canvas Domain',
};

const SiteForm = (props) => {
  const {
    isUpdate,
    oauth_key,
    oauth_secret,
    url,
    onChange,
    setupSite,
    closeModal,
  } = props;
  const buttonVerb = isUpdate ? 'Update' : 'Create';

  const inputTemplate = (fieldLabel, field, value) => {
    const inputProps = {
      id: `site_${field}`,
      name: field,
      type: 'text',
      value: value || '',
      onChange,
    };
    return (
      <div key={field} className="o-grid__item u-full">
        <Input
          className="c-input"
          labelText={fieldLabel}
          inputProps={inputProps}
        />
      </div>
    );
  };

  return (
    <form>
      <div className="o-grid o-grid__modal-top">
        {inputTemplate(FIELDS.url, 'url', url)}
        {inputTemplate(FIELDS.oauth_key, 'oauth_key', oauth_key)}
        {inputTemplate(FIELDS.oauth_secret, 'oauth_secret', oauth_secret)}
      </div>


      <button
        type="button"
        className="c-btn c-btn--yellow"
        onClick={setupSite}
      >
        {buttonVerb} Domain
      </button>
      <button
        type="button"
        className="c-btn c-btn--gray--large u-m-right"
        onClick={closeModal}
      >
        Cancel
      </button>
    </form>
  );
};

SiteForm.propTypes = {
  setupSite: PropTypes.func.isRequired,
  closeModal: PropTypes.func.isRequired,
  onChange: PropTypes.func.isRequired,
  isUpdate: PropTypes.bool.isRequired,
  oauth_key: PropTypes.string,
  oauth_secret: PropTypes.string,
  url: PropTypes.string,
};

export default SiteForm;<commit_msg>removed bad useEffect. fixed prop spreading issue<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import Input from '../common/input';

export const FIELDS = {
  oauth_key: 'Canvas Developer ID',
  oauth_secret: 'Canvas Developer Key',
  url: 'Canvas Domain',
};

export default function SiteForm(props) {
  const {
    isUpdate,
    oauth_key: oauthKey,
    oauth_secret: oauthSecret,
    url,
    onChange,
    setupSite,
    closeModal,
  } = props;
  const buttonVerb = isUpdate ? 'Update' : 'Create';

  const inputTemplate = (fieldLabel, field, value) => {
    const inputProps = {
      id: `site_${field}`,
      name: field,
      type: 'text',
      value: value || '',
      onChange,
    };
    return (
      <div key={field} className="o-grid__item u-full">
        <Input
          className="c-input"
          labelText={fieldLabel}
          inputProps={inputProps}
        />
      </div>
    );
  };

  return (
    <form>
      <div className="o-grid o-grid__modal-top">
        {inputTemplate(FIELDS.url, 'url', url)}
        {inputTemplate(FIELDS.oauth_key, 'oauth_key', oauthKey)}
        {inputTemplate(FIELDS.oauth_secret, 'oauth_secret', oauthSecret)}
      </div>
      <button
        type="button"
        className="c-btn c-btn--yellow"
        onClick={setupSite}
      >
        {buttonVerb}
        {' '}
        Domain
      </button>
      <button
        type="button"
        className="c-btn c-btn--gray--large u-m-right"
        onClick={closeModal}
      >
        Cancel
      </button>
    </form>
  );
}

SiteForm.propTypes = {
  setupSite: PropTypes.func.isRequired,
  closeModal: PropTypes.func.isRequired,
  onChange: PropTypes.func.isRequired,
  isUpdate: PropTypes.bool.isRequired,
  oauth_key: PropTypes.string,
  oauth_secret: PropTypes.string,
  url: PropTypes.string,
};
{'fraction_non_alphanumeric': 0.13351648351648351, 'fraction_numerical': 0.0, 'mean_word_length': 2.4842105263157896, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4142006', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1190, 'n_words': 243}