<commit_before>import React, { Component } from 'react';
import '../styles/WeaveElement.css';

class WeaveElement extends Component {
  constructor() {
    super();
    this.handleClick = this.handleClick.bind(this);
  }

  componentState() {
    const row = this.props.row;
    const col = this.props.col;
    const weaves = this.props.currentState.weaves;

    if (weaves[row]) {
      if (weaves[row][col] === undefined || weaves[row][col] === false) {
          return false;
      } else {
        return true;
      }
    } else {
      return false;
    }
  }

  render() {
    const style = this.componentState()
      ? "WeaveElement redWeaveElement"
      : "WeaveElement whiteWeaveElement";

    return (<div onClick={this.handleClick} className={style}></div>);
  }

  handleClick(e) {
    if (this.componentState()) this.props.offClick(this.props.row, this.props.col);
    else this.props.onClick(this.props.row, this.props.col);
  }
}

export default WeaveElement;
<commit_msg>Add whiteElement to code<commit_after>import React, { Component } from 'react';
import '../styles/WeaveElement.css';
import '../styles/Scheme4.css';

class WeaveElement extends Component {
  constructor() {
    super();
    this.handleClick = this.handleClick.bind(this);
  }

  componentState() {
    const row = this.props.row;
    const col = this.props.col;
    const weaves = this.props.currentState.weaves;

    if (weaves[row]) {
      if (weaves[row][col] === undefined || weaves[row][col] === false) {
          return false;
      } else {
        return true;
      }
    } else {
      return false;
    }
  }

  render() {
    const style = this.componentState()
      ? "WeaveElement redWeaveElement"
      : "WeaveElement whiteElement";

    return (<div onClick={this.handleClick} className={style}></div>);
  }

  handleClick(e) {
    if (this.componentState()) this.props.offClick(this.props.row, this.props.col);
    else this.props.onClick(this.props.row, this.props.col);
  }
}

export default WeaveElement;

{'fraction_non_alphanumeric': 0.14554455445544554, 'fraction_numerical': 0.0004950495049504951, 'mean_word_length': 2.970530451866405, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1531262', 'n_tokens_mistral': 651, 'n_tokens_neox': 638, 'n_words': 131}