<commit_before>import React from 'react';
import { observer, PropTypes as MobxPropTypes } from 'mobx-react';
import cn from 'classnames';
import { action, computed } from 'mobx';
import { Modal, Button } from 'react-bootstrap';
import ExternalLink from '../../components/new-tab-link';
import Icon from '../../components/icon';

@observer
export default class SetWeightsModal extends React.Component {

  static propTypes = {
    ux: MobxPropTypes.observableObject,
  }

  render() {
    const { ux: { weights } } = this.props;
    if (!weights.isSetting) { return null; }

    return (
      <Modal
        animation={false}
        show={true}
        backdrop="static"
        className="set-weights"
      >
        <Modal.Header>
          Set course average weights
        </Modal.Header>
        <Modal.Body>
          <div>
            We recommend using homework scores and reading progress.
          </div>
          <ExternalLink
            to="http://google.com"
            className="set-weights--external-link"
          >
            See why <Icon type="external-link"/>
          </ExternalLink>

          <label className="weight">
            <div>Homework scores</div>
            <div>
              <input
                type="number"
                name="homework_scores"
                value={weights.homework_scores}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <label className="weight">
            <div>Homework progress</div>
            <div>
              <input
                type="number"
                name="homework_progress"
                value={weights.homework_progress}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <label className="weight">
            <div>Reading scores</div>
            <div>
              <input
                type="number"
                name="reading_scores"
                value={weights.reading_scores}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <label className="weight">
            <div>Reading progress</div>
            <div>
              <input
                type="number"
                name="reading_progress"
                value={weights.reading_progress}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <p className={cn('valid-msg', { invalid: !weights.isValid })}>
            <Icon type="info-circle"/> Weights must total 100%
          </p>
        </Modal.Body>
        <Modal.Footer>
          <Button onClick={weights.saveWeights} disabled={!weights.isValid}>Save</Button>
          <Button onClick={weights.setDefaultWeights} disabled={!weights.isValid}>Restore default</Button>
          <Button onClick={weights.onCancelClick}>Cancel</Button><commit_msg>fix reset disabling<commit_after>import React from 'react';
import { observer, PropTypes as MobxPropTypes } from 'mobx-react';
import cn from 'classnames';
import { action, computed } from 'mobx';
import { Modal, Button } from 'react-bootstrap';
import ExternalLink from '../../components/new-tab-link';
import Icon from '../../components/icon';

@observer
export default class SetWeightsModal extends React.Component {

  static propTypes = {
    ux: MobxPropTypes.observableObject,
  }

  render() {
    const { ux: { weights } } = this.props;
    if (!weights.isSetting) { return null; }

    return (
      <Modal
        animation={false}
        show={true}
        backdrop="static"
        className="set-weights"
      >
        <Modal.Header>
          Set course average weights
        </Modal.Header>
        <Modal.Body>
          <div>
            We recommend using homework scores and reading progress.
          </div>
          <ExternalLink
            to="http://google.com"
            className="set-weights--external-link"
          >
            See why <Icon type="external-link"/>
          </ExternalLink>

          <label className="weight">
            <div>Homework scores</div>
            <div>
              <input
                type="number"
                name="homework_scores"
                value={weights.homework_scores}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <label className="weight">
            <div>Homework progress</div>
            <div>
              <input
                type="number"
                name="homework_progress"
                value={weights.homework_progress}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <label className="weight">
            <div>Reading scores</div>
            <div>
              <input
                type="number"
                name="reading_scores"
                value={weights.reading_scores}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <label className="weight">
            <div>Reading progress</div>
            <div>
              <input
                type="number"
                name="reading_progress"
                value={weights.reading_progress}
                onChange={weights.setWeight}
              />%
            </div>
          </label>
          <p className={cn('valid-msg', { invalid: !weights.isValid })}>
            <Icon type="info-circle"/> Weights must total 100%
          </p>
        </Modal.Body>
        <Modal.Footer>
          <Button onClick={weights.saveWeights} disabled={!weights.isValid}>Save</Button>
          <Button onClick={weights.setDefaultWeights}>Restore default</Button>
          <Button onClick={weights.onCancelClick}>Cancel</Button>
{'fraction_non_alphanumeric': 0.11959505833905285, 'fraction_numerical': 0.001029512697323267, 'mean_word_length': 1.5735099337748344, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 99, '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': '5391474', 'n_tokens_mistral': 1522, 'n_tokens_neox': 1463, 'n_words': 308}