mirror of
https://github.com/desktop/desktop
synced 2024-09-20 00:21:23 +00:00
start enhancing FileDiff to obtain some data
This commit is contained in:
parent
2ebee996d9
commit
ebace5a7cc
|
@ -141,7 +141,9 @@ export class Changes extends React.Component<IChangesProps, IChangesState> {
|
|||
onIncludeChanged={(row, include) => this.handleIncludeChanged(row, include) }
|
||||
onSelectAll={selectAll => this.handleSelectAll(selectAll) }/>
|
||||
|
||||
<FileDiff path={selectedFilePath} />
|
||||
<FileDiff selectedRepo={this.props.selectedRepo}
|
||||
relativePath={selectedFilePath}
|
||||
readOnly={false} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,14 +1,32 @@
|
|||
import * as React from 'react'
|
||||
|
||||
import { IRepository } from '../models/repository'
|
||||
|
||||
interface IFileDiffProps {
|
||||
path: string | null
|
||||
readonly selectedRepo: IRepository
|
||||
readonly readOnly: boolean
|
||||
readonly relativePath: string | null
|
||||
}
|
||||
|
||||
export default class FileDiff extends React.Component<IFileDiffProps, void> {
|
||||
|
||||
public componentWillReceiveProps(nextProps: IFileDiffProps) {
|
||||
|
||||
this.renderDiff(nextProps.selectedRepo, nextProps.relativePath, nextProps.readOnly)
|
||||
}
|
||||
|
||||
private renderDiff(repository: IRepository, relativePath: string | null, readOnly: boolean) {
|
||||
if (!relativePath) {
|
||||
// TOOD: don't render anything
|
||||
} else {
|
||||
// LocalGitOperations.getDiff(repository.path, relativePath)
|
||||
}
|
||||
}
|
||||
|
||||
public render() {
|
||||
|
||||
if (this.props.path) {
|
||||
return <div id='file-diff'>Diff for '{this.props.path} goes here</div>
|
||||
if (this.props.relativePath) {
|
||||
return <div id='file-diff'>Diff for '{this.props.relativePath} goes here</div>
|
||||
} else {
|
||||
return <div id='file-diff'>No file selected</div>
|
||||
}
|
||||
|
|
|
@ -50,12 +50,14 @@ export default class History extends React.Component<IHistoryProps, IHistoryStat
|
|||
<div id='history'>
|
||||
<CommitList commits={this.state.commits}
|
||||
selectedCommit={this.state.selection.commit}
|
||||
onCommitSelected={row => this.onCommitSelected(row)}/>
|
||||
onCommitSelected={commit => this.onCommitSelected(commit) } />
|
||||
<CommitSummaryContainer repository={this.props.repository}
|
||||
commit={commit}
|
||||
selectedFile={this.state.selection.file}
|
||||
onSelectedFileChanged={file => this.onFileSelected(file)}/>
|
||||
<FileDiff path={selectedFile ? selectedFile.path : null}/>
|
||||
<FileDiff selectedRepo={this.props.repository}
|
||||
relativePath={selectedFile ? selectedFile.path : null}
|
||||
readOnly={true} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue