<commit_before>import * as React from 'react'

import { FileStatus } from '../../models/status'
import { Octicon, OcticonSymbol } from '../octicons'
import { showContextualMenu } from '../main-process-proxy'
import { Checkbox, CheckboxValue } from './checkbox'
import { assertNever } from '../../lib/fatal-error'

interface IChangedFileProps {
  path: string
  status: FileStatus
  oldPath?: string
  include: boolean | null
  onIncludeChanged: (path: string, include: boolean) => void
  onDiscardChanges: (path: string) => void
}

/** a changed file in the working directory for a given repository */
export class ChangedFile extends React.Component<IChangedFileProps, void> {

  private static mapStatus(status: FileStatus): string {
    switch (status) {
      case FileStatus.New: return 'New'
      case FileStatus.Modified: return 'Modified'
      case FileStatus.Deleted: return 'Deleted'
      case FileStatus.Renamed: return 'Renamed'
      case FileStatus.Conflicted: return 'Conflicted'
      case FileStatus.Copied: return 'Copied'
    }

    return assertNever(status, `Unknown file status ${status}`)
  }

  private handleCheckboxChange = (event: React.FormEvent<HTMLInputElement>) => {
    const include = event.currentTarget.checked
    this.props.onIncludeChanged(this.props.path, include)
    event.preventDefault()
  }

  private get checkboxValue(): CheckboxValue {
    if (this.props.include === true) {
      return CheckboxValue.On
    } else if (this.props.include === false) {
      return CheckboxValue.Off
    } else {
      return CheckboxValue.Mixed
    }
  }

  public renderPathLabel() {
    const props: React.HTMLProps<HTMLLabelElement> = {
      className: 'path',
      title: this.props.path,
    }

    if (this.props.status === FileStatus.Renamed && this.props.oldPath) {
      return (
        <label {...props}>
          {this.props.oldPath} <Octicon symbol={OcticonSymbol.arrowRight} /> {this.props.path}
        </label>
      )<commit_msg>This shouldn't be prevented, my bad<commit_after>import * as React from 'react'

import { FileStatus } from '../../models/status'
import { Octicon, OcticonSymbol } from '../octicons'
import { showContextualMenu } from '../main-process-proxy'
import { Checkbox, CheckboxValue } from './checkbox'
import { assertNever } from '../../lib/fatal-error'

interface IChangedFileProps {
  path: string
  status: FileStatus
  oldPath?: string
  include: boolean | null
  onIncludeChanged: (path: string, include: boolean) => void
  onDiscardChanges: (path: string) => void
}

/** a changed file in the working directory for a given repository */
export class ChangedFile extends React.Component<IChangedFileProps, void> {

  private static mapStatus(status: FileStatus): string {
    switch (status) {
      case FileStatus.New: return 'New'
      case FileStatus.Modified: return 'Modified'
      case FileStatus.Deleted: return 'Deleted'
      case FileStatus.Renamed: return 'Renamed'
      case FileStatus.Conflicted: return 'Conflicted'
      case FileStatus.Copied: return 'Copied'
    }

    return assertNever(status, `Unknown file status ${status}`)
  }

  private handleCheckboxChange = (event: React.FormEvent<HTMLInputElement>) => {
    const include = event.currentTarget.checked
    this.props.onIncludeChanged(this.props.path, include)
  }

  private get checkboxValue(): CheckboxValue {
    if (this.props.include === true) {
      return CheckboxValue.On
    } else if (this.props.include === false) {
      return CheckboxValue.Off
    } else {
      return CheckboxValue.Mixed
    }
  }

  public renderPathLabel() {
    const props: React.HTMLProps<HTMLLabelElement> = {
      className: 'path',
      title: this.props.path,
    }

    if (this.props.status === FileStatus.Renamed && this.props.oldPath) {
      return (
        <label {...props}>
          {this.props.oldPath} <Octicon symbol={OcticonSymbol.arrowRight} /> {this.props.path}
        </label>
      )
{'fraction_non_alphanumeric': 0.11941428932087857, 'fraction_numerical': 0.0, 'mean_word_length': 3.344298245614035, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 21, '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': '4873423', 'n_tokens_mistral': 1153, 'n_tokens_neox': 1137, 'n_words': 306}