<commit_before>import * as React from 'react'
import { CommitSummaryContainer } from './commit-summary-container'
import { Diff } from '../diff'
import { FileList } from './file-list'
import { Repository } from '../../models/repository'
import { FileChange } from '../../models/status'
import { Commit } from '../../lib/local-git-operations'
import { Dispatcher } from '../../lib/dispatcher'
import { IHistoryState } from '../../lib/app-state'
import { ThrottledScheduler } from '../lib/throttled-scheduler'
import { PersistingResizable } from '../resizable'

// At some point we'll make index.tsx only be exports
// see https://github.com/desktop/desktop/issues/383
export { HistorySidebar } from './sidebar'

interface IHistoryProps {
  readonly repository: Repository
  readonly dispatcher: Dispatcher
  readonly history: IHistoryState
  readonly emoji: Map<string, string>
  readonly commits: Map<string, Commit>
}

/** The History component. Contains the commit list, commit summary, and diff. */
export class History extends React.Component<IHistoryProps, void> {
  private readonly loadChangedFilesScheduler = new ThrottledScheduler(200)

  private onFileSelected(file: FileChange) {
    this.props.dispatcher.changeHistoryFileSelection(this.props.repository, file)
  }

  public componentWillUnmount() {
    this.loadChangedFilesScheduler.clear()
  }

  private renderDiff(commit: Commit | null) {

    const file = this.props.history.selection.file
    const diff = this.props.history.diff

    if (!diff || !file) {
      return (
        <div className='panel blankslate' id='diff'>
          No file selected
        </div>
      )
    }

    return (
      <Diff repository={this.props.repository}
        file={file}
        diff={diff}
        readOnly={true}
        dispatcher={this.props.dispatcher} />
    )
  }

  public render() {
    const sha = this.props.history.selection.sha
    const commit = sha ? (this.props.commits.get(sha) || null) : null

    return (
      <div className='panel-container' id='history'>
        <PersistingResizable configKey='commit-summary-width'>
          <CommitSummaryContainer repository={this.props.repository}
                                  commit={commit}
                                  files={this.props.history.changedFiles}
                                  emoji={this.props.emoji}/>
          <FileList
            files={this.props.history.changedFiles}
            onSelectedFileChanged={file => this.onFileSelected(file)}
            selectedFile={this.props.history.selection.file}
          />
        </PersistingResizable>
        { this.renderDiff(commit) }
      </div>
    )
  }
}<commit_msg>Remove panel container from history<commit_after>import * as React from 'react'
import { CommitSummaryContainer } from './commit-summary-container'
import { Diff } from '../diff'
import { FileList } from './file-list'
import { Repository } from '../../models/repository'
import { FileChange } from '../../models/status'
import { Commit } from '../../lib/local-git-operations'
import { Dispatcher } from '../../lib/dispatcher'
import { IHistoryState } from '../../lib/app-state'
import { ThrottledScheduler } from '../lib/throttled-scheduler'
import { PersistingResizable } from '../resizable'

// At some point we'll make index.tsx only be exports
// see https://github.com/desktop/desktop/issues/383
export { HistorySidebar } from './sidebar'

interface IHistoryProps {
  readonly repository: Repository
  readonly dispatcher: Dispatcher
  readonly history: IHistoryState
  readonly emoji: Map<string, string>
  readonly commits: Map<string, Commit>
}

/** The History component. Contains the commit list, commit summary, and diff. */
export class History extends React.Component<IHistoryProps, void> {
  private readonly loadChangedFilesScheduler = new ThrottledScheduler(200)

  private onFileSelected(file: FileChange) {
    this.props.dispatcher.changeHistoryFileSelection(this.props.repository, file)
  }

  public componentWillUnmount() {
    this.loadChangedFilesScheduler.clear()
  }

  private renderDiff(commit: Commit | null) {

    const file = this.props.history.selection.file
    const diff = this.props.history.diff

    if (!diff || !file) {
      return (
        <div className='panel blankslate' id='diff'>
          No file selected
        </div>
      )
    }

    return (
      <Diff repository={this.props.repository}
        file={file}
        diff={diff}
        readOnly={true}
        dispatcher={this.props.dispatcher} />
    )
  }

  public render() {
    const sha = this.props.history.selection.sha
    const commit = sha ? (this.props.commits.get(sha) || null) : null

    return (
      <div id='history'>
        <PersistingResizable configKey='commit-summary-width'>
          <CommitSummaryContainer repository={this.props.repository}
                                  commit={commit}
                                  files={this.props.history.changedFiles}
                                  emoji={this.props.emoji}/>
          <FileList
            files={this.props.history.changedFiles}
            onSelectedFileChanged={file => this.onFileSelected(file)}
            selectedFile={this.props.history.selection.file}
          />
        </PersistingResizable>
        { this.renderDiff(commit) }
      </div>
    )
  }
}
{'fraction_non_alphanumeric': 0.12280044926993636, 'fraction_numerical': 0.0022463496817671283, 'mean_word_length': 2.6975778546712803, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '897169', 'n_tokens_mistral': 1475, 'n_tokens_neox': 1449, 'n_words': 339}