<commit_before>import * as React from 'react'

import { Repository } from '../../models/repository'
import { Dispatcher } from '../dispatcher'
import { WorkingDirectoryFileChange } from '../../models/status'
import { Dialog, DialogContent, DialogFooter } from '../dialog'
import { PathText } from '../lib/path-text'
import { Monospaced } from '../lib/monospaced'
import { Checkbox, CheckboxValue } from '../lib/checkbox'
import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group'
import { ITextDiff, DiffSelection } from '../../models/diff'

interface IDiscardSelectionProps {
  readonly repository: Repository
  readonly dispatcher: Dispatcher
  /**
   * The file where the selection of changes to discard should be applied.
   */
  readonly file: WorkingDirectoryFileChange
  /**
   * The current diff with the local changes for that file.
   */
  readonly diff: ITextDiff
  /**
   * The selection (based on the passed diff) of changes to discard.
   */
  readonly selection: DiffSelection
  /**
   * Function called when the user either dismisses the dialog or
   * the discard operation finishes.
   */
  readonly onDismissed: () => void
}

interface IDiscardSelectionState {
  /**
   * Whether or not we're currently in the process of discarding
   * changes. This is used to display a loading state
   */
  readonly isDiscardingSelection: boolean
  /**
   * Whether or not the "do not show this message again" checkbox
   * is checked.
   */
  readonly confirmDiscardSelection: boolean
}

/** A component to confirm and then discard changes from a selection. */
export class DiscardSelection extends React.Component<
  IDiscardSelectionProps,
  IDiscardSelectionState
> {
  public state: IDiscardSelectionState = {
    isDiscardingSelection: false,
    confirmDiscardSelection: true,
  }

  private getOkButtonLabel() {
    return __DARWIN__ ? 'Discard Changes' : 'Discard changes'
  }

  public render() {
    const isDiscardingChanges = this.state.isDiscardingSelection<commit_msg>Revert "Remove constructor from component"<commit_after>import * as React from 'react'

import { Repository } from '../../models/repository'
import { Dispatcher } from '../dispatcher'
import { WorkingDirectoryFileChange } from '../../models/status'
import { Dialog, DialogContent, DialogFooter } from '../dialog'
import { PathText } from '../lib/path-text'
import { Monospaced } from '../lib/monospaced'
import { Checkbox, CheckboxValue } from '../lib/checkbox'
import { OkCancelButtonGroup } from '../dialog/ok-cancel-button-group'
import { ITextDiff, DiffSelection } from '../../models/diff'

interface IDiscardSelectionProps {
  readonly repository: Repository
  readonly dispatcher: Dispatcher
  /**
   * The file where the selection of changes to discard should be applied.
   */
  readonly file: WorkingDirectoryFileChange
  /**
   * The current diff with the local changes for that file.
   */
  readonly diff: ITextDiff
  /**
   * The selection (based on the passed diff) of changes to discard.
   */
  readonly selection: DiffSelection
  /**
   * Function called when the user either dismisses the dialog or
   * the discard operation finishes.
   */
  readonly onDismissed: () => void
}

interface IDiscardSelectionState {
  /**
   * Whether or not we're currently in the process of discarding
   * changes. This is used to display a loading state
   */
  readonly isDiscardingSelection: boolean
  /**
   * Whether or not the "do not show this message again" checkbox
   * is checked.
   */
  readonly confirmDiscardSelection: boolean
}

/** A component to confirm and then discard changes from a selection. */
export class DiscardSelection extends React.Component<
  IDiscardSelectionProps,
  IDiscardSelectionState
> {
  public constructor(props: IDiscardSelectionProps) {
    super(props)

    this.state = {
      isDiscardingSelection: false,
      confirmDiscardSelection: true,
    }
  }

  private getOkButtonLabel() {
    return __DARWIN__ ? 'Discard Changes' : 'Discard changes'
  }

  public render() {
    const isDiscardingChanges = this.state.isDiscardingSelection
{'fraction_non_alphanumeric': 0.09708975299584251, 'fraction_numerical': 0.0, 'mean_word_length': 3.6319365798414496, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1083138', 'n_tokens_mistral': 1114, 'n_tokens_neox': 1088, 'n_words': 385}