<commit_before>import { h, Component } from 'preact';
import Guid from './Guid';
import { clipy, generateGuids } from './utils';

/* eslint-disable no-console */

const COPYALL = 'copy-all';
const COPIED = 'copied!';

export default class Generate extends Component {
  constructor() {
    super();
    this.state = { guids: [], guidComponents: [], copyButtonText: COPYALL, guidsClass: '' };
  }

  componentDidMount() {
    this.buildGuids();
  }

  buildGuids = () => {
    this.clearCopyAll();
    this.setState({ guids: generateGuids() });
    let guids = [];
    for (let guid of this.state.guids)
      guids.push(<Guid guid={guid} />);
    this.setState({ guidComponents: guids, guidsClass: '' });
  };

  copyAll = () => {
    this.setState({ guids: this.state.guidComponents.map((g) => { return g.attributes.guid; }), copyButtonText: COPIED, guidsClass: 'red' });
    clipy(this.state.guids.join('\n'));
    setTimeout(() => this.clearCopyAll(), 2500);
  };

  clearCopyAll = () => {
    this.setState({ copyButtonText: COPYALL });
  }

  render() {
    return (
      <div>
        <h2>generate</h2>
        <div class="bottom">
          <input type="checkbox" id="single" /><label for="single">single</label>
          <input type="checkbox" id="double" /><label for="double">double</label>
          <button class="hundred" onClick={this.buildGuids}>refresh</button>
          <button class="hundred" onClick={this.copyAll}>{this.state.copyButtonText}</button>
        </div>
        <div class={this.state.guidsClass}>
          {this.state.guidComponents}
        </div>
      </div>
    );
  }
}<commit_msg>quotes<commit_after>import { h, Component } from 'preact';
import Guid from './Guid';
import { clipy, generateGuids } from './utils';

/* eslint-disable no-console */

const COPYALL = 'copy-all';
const COPIED = 'copied!';

export default class Generate extends Component {
  constructor() {
    super();
    this.state = {
      guids: [],
      guidComponents: [],
      copyButtonText: COPYALL,
      guidsClass: '',
      singleChecked: false,
      doubleChecked: false
    };
  }

  componentDidMount() {
    this.buildGuids();
  }

  buildGuids = () => {
    this.clearCopyAll();
    this.setState({ guids: generateGuids() });
    let guids = [];
    for (let guid of this.state.guids)
      guids.push(<Guid guid={guid} />);
    this.setState({ guidComponents: guids, guidsClass: '' });
  };

  copyAll = () => {
    this.setState({ guids: this.state.guidComponents.map((g) => { return g.attributes.guid; }), copyButtonText: COPIED, guidsClass: 'red' });
    clipy(this.state.guids.join('\n'));
    setTimeout(() => this.clearCopyAll(), 2500);
  };

  clearCopyAll = () => {
    this.setState({ copyButtonText: COPYALL });
  }

  singleClick = () => {
    if (this.state.doubleChecked) {
      this.setState({ doubleChecked: false });
    }
    this.setState({ singleChecked: !this.state.singleChecked });
    if (this.state.singleChecked) {
      //let guids = [];
      for (let guid of this.state.guids)
        console.log(guid);
        //TODO
    }
  }

  doubleClick = () => {
    console.log('double');
  }

  render() {
    return (
      <div>
        <h2>generate</h2>
        <div class="bottom">
          <input type="checkbox" id="single" onclick={this.singleClick} checked={this.state.singleChecked} /><label for="single">single</label>
          <input type="checkbox" id="double" onclick={this.doubleClick} checked={this.state.doubleChecked} /><label for="double">double</label>
          <button class="hundred" onClick={this.buildGuids}>refresh</button>
          <button class="hundred" onClick={this.copyAll}>{this.state.copyButtonText}</button>
        </div>
        <div class={this.state.guidsClass}>
          {this.state.guidComponents}
        </div>
      </div>
    );
  }
}
{'fraction_non_alphanumeric': 0.17653194263363756, 'fraction_numerical': 0.0031290743155149934, 'mean_word_length': 2.950566426364573, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 53, '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': '2078249', 'n_tokens_mistral': 1228, 'n_tokens_neox': 1212, 'n_words': 234}