<commit_before>import * as React from 'react';
import ToggleDisplay from 'react-toggle-display'
import {
  Dialog, showDialog
} from '@jupyterlab/apputils';

import {
  JupyterLab
} from '@jupyterlab/application';

import {
  PathExt 
} from '@jupyterlab/coreutils';

import {
  Git, GitShowPrefixResult
} from '../git'

import '../../style/index.css';

/**
 * The class name added to the git-plugin sessions items.
 */
const GIT_FILE = 'jp-Git-file';

/**
 * The class name added to a git-plugin session item icon.
 */
const GIT_FILE_ICON = 'jp-Git-fileIcon';

/**
 * The class name added to a git-plugin session item label.
 */
const GIT_FILE_LABEL = 'jp-Git-fileLabel';

/**
 * The class name added to a git-plugin session item git-add button.
 */
const GIT_BUTTON_ADD = 'jp-Git-button-add';

/**
 * The class name added to a git-plugin session item git-reset button.
 */
const GIT_BUTTON_RESET = 'jp-Git-button-reset';

/**
 * The class name added to a git-plugin session item git-reset button.
 */
const GIT_BUTTON_RESET_WHITE = 'jp-Git-button-reset-white';


/**
 * The class name added to a git-plugin session item discard button.
 */
const GIT_BUTTON_DISCARD = 'jp-Git-button-discard';

/**
 * The class name added to a git-plugin session item track button.
 */
const GIT_BUTTON_TRACK = 'jp-Git-button-track';

 /**
 * The class name added to a git-plugin session item white expand button.
 */
const GIT_BUTTON_TRIANGLE_DOWN_WHITE = 'jp-Git-button-triangle-down-white';

const GIT_BUTTON_TRIANGLE_RIGHT_WHITE = 'jp-Git-button-triangle-right-white';
/**
 * The class name added to a git-plugin session item white collapse button.

const GIT_BUTTON_TRIANGLE_RIGHT_WHITE = 'jp-Git-button-triangle-right-white';
*/

 /**
 * The class name added to a git-plugin session item expand button.
 */
const GIT_BUTTON_TRIANGLE_DOWN = 'jp-Git-button-triangle-down';

const GIT_BUTTON_TRIANGLE_RIGHT = 'jp-Git-button-triangle-right';
/**
 * The class name added to a git-plugin session item collapse button.
const GIT_BUTTON_TRIANGLE_RIGHT = 'jp-Git-button-triangle-right';
 */

/**
 * The class name added to a markdown file browser item.
 */
const MARKDOWN_ICON_CLASS = 'jp-MarkdownIcon';

/**
 * The class name added to a python file browser item.
 */
const PYTHON_ICON_CLASS = 'jp-PythonIcon';

/**
 * The class name added to a JSON file browser item.
 */
const JSON_ICON_CLASS = 'jp-JSONIcon';

/**
 * The class name added to a speadsheet file browser item.
 */
const SPREADSHEET_ICON_CLASS = 'jp-SpreadsheetIcon';

/**
 * The class name added to a R Kernel file browser item.
 */
const RKERNEL_ICON_CLASS = 'jp-RKernelIcon';

/**
 * The class name added to a YAML file browser item.
 */
const YAML_ICON_CLASS = 'jp-YamlIcon';

/**
 * The class added for image file browser items.
 */
const IMAGE_ICON_CLASS = 'jp-ImageIcon';

/**
 * The class name added to a file type content item.
 */
const FILE_TYPE_CLASS = 'jp-FileIcon';

/**
 * The class name added to a directory file browser item.
 */
const FOLDER_MATERIAL_ICON_CLASS = 'jp-OpenFolderIcon';

export namespace StatusFiles {
  export
  interface IState {
    commit_msg:string;
    commit_disable:boolean
    staged_show:boolean
    unstaged_show:boolean
    untracked_show:boolean
  }

  export
  interface IProps {
    current_fb_path:string;
    top_repo_path: string;

    staged_files: any;
    unstaged_files: any;
    untracked_files: any;
    
    app:JupyterLab;
    refresh: any;
  }
}

export class StatusFiles extends React.Component<StatusFiles.IProps, StatusFiles.IState>{
  constructor(props: StatusFiles.IProps) {
    super(props);
    this.state={commit_msg:'', commit_disable:true, staged_show:true, unstaged_show:true, untracked_show:true};
    this.handleChange = this.handleChange.bind(this);
    this.init_input = this.init_input.bind(this)
  }
  handleChange(event){
    if(event.target.value&&event.target.value!=''){
      this.setState({commit_msg:event.target.value,commit_disable:false});
    }
    else{
      this.setState({commit_msg:event.target.value,commit_disable:true});
    }
  }

  init_input(){
    this.setState({commit_msg:'',commit_disable:true});
  }

  /** to prevent ENTER key trigged 'submit' action during inputing commit msg*/
  onKeyPress(event){
    if (event.which === 13 /* Enter */) {
      event.preventDefault();
    }
  }

  dropdown_staged(){
    this.setState({staged_show:!(this.state.staged_show)});
  }

  dropdown_unstaged(){
    this.setState({unstaged_show:!(this.state.unstaged_show)});
  }

  dropdown_untracked(){
    this.setState({untracked_show:!(this.state.untracked_show)});
  }

  commit_box_class_selection(disable:boolean, files_num:number):string{
    if(disable) {<commit_msg>new test<commit_after>import * as React from 'react';
import ToggleDisplay from 'react-toggle-display'
import {
  Dialog, showDialog
} from '@jupyterlab/apputils';

import {
  JupyterLab
} from '@jupyterlab/application';

import {
  PathExt 
} from '@jupyterlab/coreutils';

import {
  Git, GitShowPrefixResult
} from '../git'

import '../../style/index.css';

/**
 * The class name added to the git-plugin sessions items.
 */
const GIT_FILE = 'jp-Git-file';

/**
 * The class name added to a git-plugin session item icon.
 */
const GIT_FILE_ICON = 'jp-Git-fileIcon';

/**
 * The class name added to a git-plugin session item label.
 */
const GIT_FILE_LABEL = 'jp-Git-fileLabel';

/**
 * The class name added to a git-plugin session item git-add button.
 */
const GIT_BUTTON_ADD = 'jp-Git-button-add';

/**
 * The class name added to a git-plugin session item git-reset button.
 */
const GIT_BUTTON_RESET = 'jp-Git-button-reset';

/**
 * The class name added to a git-plugin session item git-reset button.
 */
const GIT_BUTTON_RESET_WHITE = 'jp-Git-button-reset-white';


/**
 * The class name added to a git-plugin session item discard button.
 */
const GIT_BUTTON_DISCARD = 'jp-Git-button-discard';

/**
 * The class name added to a git-plugin session item track button.
 */
const GIT_BUTTON_TRACK = 'jp-Git-button-track';

 /**
 * The class name added to a git-plugin session item white expand button.
 */
const GIT_BUTTON_TRIANGLE_DOWN_WHITE = 'jp-Git-button-triangle-down-white';

const GIT_BUTTON_TRIANGLE_RIGHT_WHITE = 'jp-Git-button-triangle-right-white';
/**
 * The class name added to a git-plugin session item white collapse button.

const GIT_BUTTON_TRIANGLE_RIGHT_WHITE = 'jp-Git-button-triangle-right-white';
*/

 /**
 * The class name added to a git-plugin session item expand button.
 */
const GIT_BUTTON_TRIANGLE_DOWN = 'jp-Git-button-triangle-down';

const GIT_BUTTON_TRIANGLE_RIGHT = 'jp-Git-button-triangle-right';
/**
 * The class name added to a git-plugin session item collapse button.
const GIT_BUTTON_TRIANGLE_RIGHT = 'jp-Git-button-triangle-right';
 */

/**
 * The class name added to a markdown file browser item.
 */
const MARKDOWN_ICON_CLASS = 'jp-MarkdownIcon';

/**
 * The class name added to a python file browser item.
 */
const PYTHON_ICON_CLASS = 'jp-PythonIcon';

/**
 * The class name added to a JSON file browser item.
 */
const JSON_ICON_CLASS = 'jp-JSONIcon';

/**
 * The class name added to a speadsheet file browser item.
 */
const SPREADSHEET_ICON_CLASS = 'jp-SpreadsheetIcon';

/**
 * The class name added to a R Kernel file browser item.
 */
const RKERNEL_ICON_CLASS = 'jp-RKernelIcon';

/**
 * The class name added to a YAML file browser item.
 */
const YAML_ICON_CLASS = 'jp-YamlIcon';

/**
 * The class added for image file browser items.
 */
const IMAGE_ICON_CLASS = 'jp-ImageIcon';

/**
 * The class name added to a file type content item.
 */
const FILE_TYPE_CLASS = 'jp-FileIcon';

/**
 * The class name added to a directory file browser item.
 */
const FOLDER_MATERIAL_ICON_CLASS = 'jp-OpenFolderIcon';

export namespace StatusFiles {
  export
  interface IState {
    commit_msg:string;
    commit_disable:boolean
    staged_show:boolean
    unstaged_show:boolean
    untracked_show:boolean
  }

  export
  interface IProps {
    current_fb_path:string;
    top_repo_path: string;

    staged_files: any;
    unstaged_files: any;
    untracked_files: any;
    
    app:JupyterLab;
    refresh: any;
  }
}

export class StatusFiles extends React.Component<StatusFiles.IProps, StatusFiles.IState>{
  constructor(props: StatusFiles.IProps) {
    super(props);
    this.state={commit_msg:'', commit_disable:true, staged_show:true, unstaged_show:true, untracked_show:true};
    this.handleChange = this.handleChange.bind(this);
    this.init_input = this.init_input.bind(this)
  }
  handleChange(event){
    if(event.target.value&&event.target.value!=''){
      this.setState({commit_msg:event.target.value,commit_disable:false});
    }
    else{
      this.setState({commit_msg:event.target.value,commit_disable:true});
    }
  }

  init_input(){
    this.setState({commit_msg:'',commit_disable:true});
  }

  /** to prevent ENTER key trigged 'submit' action during inputing commit msg*/
  onKeyPress(this, event){
    if(event.which === 13 && event.shiftKey){
      this.form.submit();
    }
    else if (event.which === 13 /* Enter */) {
      event.preventDefault();
    }
  }

  dropdown_staged(){
    this.setState({staged_show:!(this.state.staged_show)});
  }

  dropdown_unstaged(){
    this.setState({unstaged_show:!(this.state.unstaged_show)});
  }

  dropdown_untracked(){
    this.setState({untracked_show:!(this.state.untracked_show)});
  }

  commit_box_class_selection(disable:boolean, files_num:number):string{
    if(disable) {
{'fraction_non_alphanumeric': 0.12323721321826983, 'fraction_numerical': 0.0006314460113660282, 'mean_word_length': 3.845996940336563, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2989441', 'n_tokens_mistral': 3303, 'n_tokens_neox': 3204, 'n_words': 795}