forked from atom/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommit-detail-container.js
More file actions
45 lines (39 loc) · 1.23 KB
/
commit-detail-container.js
File metadata and controls
45 lines (39 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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}
/>
);
}
}