<commit_before>import React, { Component } from 'react';
import ZEditor from './editor/editor';
import './App.css';
import download from 'downloadjs';

class App extends Component {
  state = {
    downloadState: null,
    importState: null
  };
  child = React.createRef();

  readFileContent = file => {
    const reader = new FileReader();
    return new Promise((resolve, reject) => {
      reader.onload = event => resolve(event.target.result);
      reader.onerror = error => reject(error);
      reader.readAsText(file);
    });
  };

  downloadZ = () => {
    var fileName = prompt('Please enter a Name for the Z file', 'Zeditor-file');
    download(JSON.stringify(this.state.downloadState), `${fileName}.ze`, 'text/plain');
  };

  setDownloadState = state => {
    this.setState({ downloadState: state });
  };

  uploadFile = event => {
    let file = event.target.files[0];
    console.log(file);
    if (file.name.substr(file.name.length - 2) != 'ze') {
      alert('not a Z Editor file');
    } else {
      this.readFileContent(file)
        .then(content => this.child.current.changeEditorStateByUpload(content))
        .catch(error => console.log(error));
    }
  };

  render() {
    return (
      <div className="flex-container">
        <div className="head">
          <div className="logo">Z-Editor</div>
          <a
            className="github-button"
            href="https://github.com/Z-Editor/Z-Editor"
            target="_blank"
            rel="noopener noreferrer"
          >
            View on Github
          </a>

          <button<commit_msg>fix: remove consoles from code<commit_after>import React, { Component } from 'react';
import ZEditor from './editor/editor';
import './App.css';
import download from 'downloadjs';

class App extends Component {
  state = {
    downloadState: null,
    importState: null
  };
  child = React.createRef();

  readFileContent = file => {
    const reader = new FileReader();
    return new Promise((resolve, reject) => {
      reader.onload = event => resolve(event.target.result);
      reader.onerror = error => reject(error);
      reader.readAsText(file);
    });
  };

  downloadZ = () => {
    var fileName = prompt('Please enter a Name for the Z file', 'Zeditor-file');
    download(JSON.stringify(this.state.downloadState), `${fileName}.ze`, 'text/plain');
  };

  setDownloadState = state => {
    this.setState({ downloadState: state });
  };

  uploadFile = event => {
    let file = event.target.files[0];
    if (file.name.substr(file.name.length - 2) != 'ze') {
      alert('not a Z Editor file');
    } else {
      this.readFileContent(file)
        .then(content => this.child.current.changeEditorStateByUpload(content))
        .catch(error => console.log(error));
    }
  };

  render() {
    return (
      <div className="flex-container">
        <div className="head">
          <div className="logo">Z-Editor</div>
          <a
            className="github-button"
            href="https://github.com/Z-Editor/Z-Editor"
            target="_blank"
            rel="noopener noreferrer"
          >
            View on Github
          </a>

          <button
{'fraction_non_alphanumeric': 0.14939987365761212, 'fraction_numerical': 0.0012634238787113076, 'mean_word_length': 2.5149833518312987, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 33, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3767081', 'n_tokens_mistral': 935, 'n_tokens_neox': 925, 'n_words': 208}