Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1807 from atom/ku-commit-item
Browse files Browse the repository at this point in the history
View commit details in pane
  • Loading branch information
kuychaco committed Dec 11, 2018
2 parents 4f3422f + 9f6ad40 commit 3c25540
Show file tree
Hide file tree
Showing 87 changed files with 4,321 additions and 758 deletions.
9 changes: 8 additions & 1 deletion docs/react-component-atlas.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ This is a high-level overview of the structure of the React component tree that
> > [`<CommitPreviewItem>`](/lig/items/commit-preview-item.js)
> > [`<CommitPreviewContainer>`](/lib/containers/commit-preview-container.js)
> >
> > The workspace-center pane that appears when looking at _all_ the staged changes that will be going into the next commit.
> > The workspace-center pane item that appears when looking at _all_ the staged changes that will be going into the next commit.
> >
> > > [`<MultiFilePatchController>`](/lib/controllers/multi-file-patch-controller.js)
> > > [`<MultiFilePatchView>`](/lib/views/multi-file-patch-view.js)
Expand All @@ -91,6 +91,13 @@ This is a high-level overview of the structure of the React component tree that
> > [`<IssueDetailView>`](/lib/views/issue-detail-view.js)
> > [`<PullRequestDetailView>`](/lib/views/pr-detail-view.js)
> >
> > The workspace-center pane item that appears when looking at all the changes
> > associated with a single commit that already exists in the current repository.
> > [`<CommitDetailItem>`](/lib/items/issueish-detail-item.js)
> > [`<CommitDetailContainer>`](/lib/containers/commit-detail-container.js)
> > [`<CommitDetailController>`](/lib/controllers/commit-detail-controller.js)
> > [`<CommitDetailView>`](/lib/views/commit-detail-controller.js)
> >
> > The workspace-center pane that displays information about a pull request or issue ("issueish", collectively) from github.com.
> >
> > > [`<IssueTimelineController>`](/lib/controllers/issue-timeline-controller.js)
Expand Down
12 changes: 12 additions & 0 deletions keymaps/git.cson
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,25 @@
'.github-CommitView-editor atom-text-editor:not([mini])':
'cmd-enter': 'github:commit'
'ctrl-enter': 'github:commit'
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'

'.github-CommitView-commitPreview':
'cmd-left': 'github:dive'
'ctrl-left': 'github:dive'
'enter': 'native!'

'.github-RecentCommits':
'enter': 'github:dive'
'cmd-left': 'github:dive'
'ctrl-left': 'github:dive'
'tab': 'core:focus-next'
'shift-tab': 'core:focus-previous'

'.github-CommitDetailView':
'cmd-right': 'github:surface'
'ctrl-right': 'github:surface'

'.github-FilePatchView atom-text-editor:not([mini])':
'cmd-/': 'github:toggle-patch-selection-mode'
'ctrl-/': 'github:toggle-patch-selection-mode'
Expand Down

Large diffs are not rendered by default.

45 changes: 45 additions & 0 deletions lib/containers/commit-detail-container.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import React from 'react';
import PropTypes from 'prop-types';
import yubikiri from 'yubikiri';

import ObserveModel from '../views/observe-model';
import LoadingView from '../views/loading-view';
import CommitDetailController from '../controllers/commit-detail-controller';

export default class CommitDetailContainer extends React.Component {
static propTypes = {
repository: PropTypes.object.isRequired,
sha: PropTypes.string.isRequired,
itemType: PropTypes.func.isRequired,
}

fetchData = repository => {
return yubikiri({
commit: repository.getCommit(this.props.sha),
currentBranch: repository.getCurrentBranch(),
currentRemote: async query => repository.getRemoteForBranch((await query.currentBranch).getName()),
isCommitPushed: repository.isCommitPushed(this.props.sha),
});
}

render() {
return (
<ObserveModel model={this.props.repository} fetchData={this.fetchData}>
{this.renderResult}
</ObserveModel>
);
}

renderResult = data => {
if (this.props.repository.isLoading() || data === null || !data.commit.isPresent()) {
return <LoadingView />;
}

return (
<CommitDetailController
{...data}
{...this.props}
/>
);
}
}
4 changes: 4 additions & 0 deletions lib/containers/issueish-detail-container.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export default class IssueishDetailContainer extends React.Component {

switchToIssueish: PropTypes.func.isRequired,
onTitleChange: PropTypes.func.isRequired,

workspace: PropTypes.object.isRequired,
}

constructor(props) {
Expand Down Expand Up @@ -169,6 +171,8 @@ export default class IssueishDetailContainer extends React.Component {
addRemote={repository.addRemote.bind(repository)}
onTitleChange={this.props.onTitleChange}
switchToIssueish={this.props.switchToIssueish}
workdirPath={repository.getWorkingDirectoryPath()}
workspace={this.props.workspace}
/>
);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 3c25540

Please sign in to comment.