2018-10-25 13:36:06 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import RepoListItem from './repo-list-item';
|
|
|
|
|
|
|
|
const propTypes = {
|
2018-12-18 17:21:01 +08:00
|
|
|
currentRepoInfo: PropTypes.object,
|
2018-12-28 14:25:25 +08:00
|
|
|
isShowFile: PropTypes.bool,
|
|
|
|
repo: PropTypes.object,
|
2018-10-25 13:36:06 +08:00
|
|
|
repoList: PropTypes.array,
|
|
|
|
selectedRepo: PropTypes.object,
|
|
|
|
initToShowChildren: PropTypes.bool.isRequired,
|
|
|
|
selectedPath: PropTypes.string,
|
|
|
|
onDirentItemClick: PropTypes.func.isRequired,
|
|
|
|
onRepoItemClick: PropTypes.func.isRequired,
|
2019-04-23 17:24:17 +08:00
|
|
|
fileSuffix: PropTypes.array,
|
2018-10-25 13:36:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class RepoListView extends React.Component {
|
|
|
|
|
|
|
|
render() {
|
2018-12-18 17:21:01 +08:00
|
|
|
let { currentRepoInfo, repoList } = this.props;
|
|
|
|
if (currentRepoInfo) {
|
2018-10-25 13:36:06 +08:00
|
|
|
repoList = [];
|
2018-12-18 17:21:01 +08:00
|
|
|
repoList.push(currentRepoInfo);
|
2018-10-25 13:36:06 +08:00
|
|
|
}
|
|
|
|
return (
|
|
|
|
<ul className="list-view-content file-chooser-item">
|
|
|
|
{repoList.length > 0 && repoList.map((repoItem, index) => {
|
|
|
|
return (
|
|
|
|
<RepoListItem
|
|
|
|
key={index}
|
|
|
|
repo={repoItem}
|
|
|
|
initToShowChildren={this.props.initToShowChildren}
|
|
|
|
selectedRepo={this.props.selectedRepo}
|
|
|
|
selectedPath={this.props.selectedPath}
|
|
|
|
onRepoItemClick={this.props.onRepoItemClick}
|
|
|
|
onDirentItemClick={this.props.onDirentItemClick}
|
2018-12-28 14:25:25 +08:00
|
|
|
isShowFile={this.props.isShowFile}
|
2019-04-23 17:24:17 +08:00
|
|
|
fileSuffix={this.props.fileSuffix}
|
2018-10-25 13:36:06 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</ul>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RepoListView.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default RepoListView;
|