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 22:51:20 +08:00
|
|
|
fileSuffixes: PropTypes.array,
|
2019-05-27 17:13:15 +08:00
|
|
|
selectedItemInfo: PropTypes.object,
|
2023-09-13 08:40:50 +08:00
|
|
|
currentPath: PropTypes.string,
|
2024-08-21 11:35:50 +08:00
|
|
|
isBrowsing: PropTypes.bool,
|
|
|
|
browsingPath: PropTypes.string,
|
2018-10-25 13:36:06 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class RepoListView extends React.Component {
|
|
|
|
|
|
|
|
render() {
|
2021-12-15 14:55:16 +08:00
|
|
|
let { currentRepoInfo, currentPath, repoList } = this.props;
|
2018-12-18 17:21:01 +08:00
|
|
|
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
|
|
|
}
|
2024-08-05 10:48:16 +08:00
|
|
|
|
2018-10-25 13:36:06 +08:00
|
|
|
return (
|
2024-08-05 10:48:16 +08:00
|
|
|
<ul className="list-view-content file-chooser-item" >
|
2018-10-25 13:36:06 +08:00
|
|
|
{repoList.length > 0 && repoList.map((repoItem, index) => {
|
|
|
|
return (
|
2020-11-02 13:56:35 +08:00
|
|
|
<RepoListItem
|
|
|
|
key={index}
|
2021-12-15 14:55:16 +08:00
|
|
|
isCurrentRepo={currentRepoInfo ? true : false}
|
|
|
|
currentPath={currentPath}
|
2018-10-25 13:36:06 +08:00
|
|
|
repo={repoItem}
|
|
|
|
initToShowChildren={this.props.initToShowChildren}
|
|
|
|
selectedRepo={this.props.selectedRepo}
|
|
|
|
selectedPath={this.props.selectedPath}
|
2020-11-02 13:56:35 +08:00
|
|
|
onRepoItemClick={this.props.onRepoItemClick}
|
2018-10-25 13:36:06 +08:00
|
|
|
onDirentItemClick={this.props.onDirentItemClick}
|
2018-12-28 14:25:25 +08:00
|
|
|
isShowFile={this.props.isShowFile}
|
2019-04-23 22:51:20 +08:00
|
|
|
fileSuffixes={this.props.fileSuffixes}
|
2019-05-27 17:13:15 +08:00
|
|
|
selectedItemInfo={this.props.selectedItemInfo}
|
2024-08-21 11:35:50 +08:00
|
|
|
isBrowsing={this.props.isBrowsing}
|
|
|
|
browsingPath={this.props.browsingPath}
|
2018-10-25 13:36:06 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
})}
|
|
|
|
</ul>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
RepoListView.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default RepoListView;
|