<commit_before>import * as React from 'react'
import { PathLabel } from '../lib/path-label'
import { AppFileStatus, AppFileStatusKind } from '../../models/status'
import { IDiff, DiffType } from '../../models/diff'
import { Octicon, OcticonSymbol, iconForStatus } from '../octicons'
import { Button } from '../lib/button'
import { enableMergeTool } from '../../lib/feature-flag'
import { mapStatus } from '../../lib/status'

interface IChangedFileDetailsProps {
  readonly path: string
  readonly status: AppFileStatus
  readonly diff: IDiff

  readonly onOpenMergeTool: (path: string) => void
}

/** Displays information about a file */
export class ChangedFileDetails extends React.Component<
  IChangedFileDetailsProps,
  {}
> {
  public render() {
    const status = this.props.status
    const fileStatus = mapStatus(status)

    return (
      <div className="header">
        <PathLabel path={this.props.path} status={this.props.status} />
        {this.renderDecorator()}

        <Octicon
          symbol={iconForStatus(status)}
          className={'status status-' + fileStatus.toLowerCase()}
          title={fileStatus}
        />
      </div>
    )
  }

  private renderDecorator() {
    const status = this.props.status
    const diff = this.props.diff
    if (status.kind === AppFileStatusKind.Conflicted && enableMergeTool()) {
      return (
        <Button className="open-merge-tool" onClick={this.onOpenMergeTool}>
          {__DARWIN__ ? 'Open Merge Tool' : 'Open merge tool'}
        </Button>
      )
    } else if (diff.kind === DiffType.Text && diff.lineEndingsChange) {
      const message = `Warning: line endings will be changed from '${
        diff.lineEndingsChange.from
      }' to '${diff.lineEndingsChange.to}'.`
      return (
        <Octicon
          symbol={OcticonSymbol.alert}
          className={'line-endings'}
          title={message}
        />
      )
    } else {
      return null
    }
  }

  private onOpenMergeTool = () => {
    this.props.onOpenMergeTool(this.props.path)
  }
}<commit_msg>Update changed-file-details.tsx<commit_after>import * as React from 'react'
import { PathLabel } from '../lib/path-label'
import { AppFileStatus, AppFileStatusKind } from '../../models/status'
import { IDiff, DiffType } from '../../models/diff'
import { Octicon, OcticonSymbol, iconForStatus } from '../octicons'
import { Button } from '../lib/button'
import { mapStatus } from '../../lib/status'

interface IChangedFileDetailsProps {
  readonly path: string
  readonly status: AppFileStatus
  readonly diff: IDiff

  readonly onOpenMergeTool: (path: string) => void
}

/** Displays information about a file */
export class ChangedFileDetails extends React.Component<
  IChangedFileDetailsProps,
  {}
> {
  public render() {
    const status = this.props.status
    const fileStatus = mapStatus(status)

    return (
      <div className="header">
        <PathLabel path={this.props.path} status={this.props.status} />
        {this.renderDecorator()}

        <Octicon
          symbol={iconForStatus(status)}
          className={'status status-' + fileStatus.toLowerCase()}
          title={fileStatus}
        />
      </div>
    )
  }

  private renderDecorator() {
    const status = this.props.status
    const diff = this.props.diff
    if (diff.kind === DiffType.Text && diff.lineEndingsChange) {
      const message = `Warning: line endings will be changed from '${
        diff.lineEndingsChange.from
      }' to '${diff.lineEndingsChange.to}'.`
      return (
        <Octicon
          symbol={OcticonSymbol.alert}
          className={'line-endings'}
          title={message}
        />
      )
    } else {
      return null
    }
  }
{'fraction_non_alphanumeric': 0.1314935064935065, 'fraction_numerical': 0.0, 'mean_word_length': 2.7044088176352705, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 20, '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': '2390737', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1065, 'n_words': 253}