2018-11-27 14:47:19 +08:00
|
|
|
import React, { Fragment } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2019-08-29 15:28:54 +08:00
|
|
|
import { Utils } from '../../utils/utils';
|
|
|
|
import SortOptionsDialog from '../../components/dialog/sort-options';
|
2018-11-27 14:47:19 +08:00
|
|
|
import DirPath from './dir-path';
|
|
|
|
import DirTool from './dir-tool';
|
|
|
|
|
|
|
|
const propTypes = {
|
2018-11-28 12:41:49 +08:00
|
|
|
repoID: PropTypes.string.isRequired,
|
2018-11-27 14:47:19 +08:00
|
|
|
repoName: PropTypes.string.isRequired,
|
2021-09-13 10:37:07 +08:00
|
|
|
userPerm: PropTypes.string,
|
2018-11-27 14:47:19 +08:00
|
|
|
currentPath: PropTypes.string.isRequired,
|
|
|
|
onPathClick: PropTypes.func.isRequired,
|
2018-12-13 14:40:09 +08:00
|
|
|
onTabNavClick: PropTypes.func,
|
|
|
|
pathPrefix: PropTypes.array,
|
2019-02-20 11:54:25 +08:00
|
|
|
isViewFile: PropTypes.bool,
|
2019-02-27 14:14:28 +08:00
|
|
|
updateUsedRepoTags: PropTypes.func.isRequired,
|
2019-03-15 10:10:24 +08:00
|
|
|
fileTags: PropTypes.array.isRequired,
|
2019-03-25 15:23:37 +08:00
|
|
|
onDeleteRepoTag: PropTypes.func.isRequired,
|
2023-09-13 08:40:50 +08:00
|
|
|
direntList: PropTypes.array,
|
|
|
|
sortBy: PropTypes.string,
|
|
|
|
sortOrder: PropTypes.string,
|
|
|
|
sortItems: PropTypes.array,
|
2018-11-27 14:47:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class CurDirPath extends React.Component {
|
|
|
|
|
2019-08-29 15:28:54 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
isSortOptionsDialogOpen: false
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
toggleSortOptionsDialog = () => {
|
|
|
|
this.setState({
|
|
|
|
isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen
|
|
|
|
});
|
2023-09-13 08:40:50 +08:00
|
|
|
};
|
2019-08-29 15:28:54 +08:00
|
|
|
|
2018-11-27 14:47:19 +08:00
|
|
|
render() {
|
2019-08-29 15:28:54 +08:00
|
|
|
const isDesktop = Utils.isDesktop();
|
2018-11-27 14:47:19 +08:00
|
|
|
return (
|
|
|
|
<Fragment>
|
2020-11-02 13:56:35 +08:00
|
|
|
<DirPath
|
2018-11-27 14:47:19 +08:00
|
|
|
repoName={this.props.repoName}
|
2018-12-11 17:52:19 +08:00
|
|
|
pathPrefix={this.props.pathPrefix}
|
2018-11-27 14:47:19 +08:00
|
|
|
currentPath={this.props.currentPath}
|
|
|
|
onPathClick={this.props.onPathClick}
|
2018-12-13 14:40:09 +08:00
|
|
|
onTabNavClick={this.props.onTabNavClick}
|
2018-12-14 04:19:24 +00:00
|
|
|
repoID={this.props.repoID}
|
|
|
|
isViewFile={this.props.isViewFile}
|
2019-03-15 10:10:24 +08:00
|
|
|
fileTags={this.props.fileTags}
|
2018-11-27 14:47:19 +08:00
|
|
|
/>
|
2019-08-29 15:28:54 +08:00
|
|
|
{isDesktop &&
|
2020-11-02 13:56:35 +08:00
|
|
|
<DirTool
|
2018-11-28 12:41:49 +08:00
|
|
|
repoID={this.props.repoID}
|
2020-11-02 13:56:35 +08:00
|
|
|
repoName={this.props.repoName}
|
2021-09-13 10:37:07 +08:00
|
|
|
userPerm={this.props.userPerm}
|
2020-11-02 13:56:35 +08:00
|
|
|
currentPath={this.props.currentPath}
|
2019-02-27 14:14:28 +08:00
|
|
|
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
2019-03-25 15:23:37 +08:00
|
|
|
onDeleteRepoTag={this.props.onDeleteRepoTag}
|
2019-08-29 15:28:54 +08:00
|
|
|
/>}
|
|
|
|
{!isDesktop && this.props.direntList.length > 0 &&
|
|
|
|
<span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
|
|
|
{this.state.isSortOptionsDialogOpen &&
|
|
|
|
<SortOptionsDialog
|
|
|
|
toggleDialog={this.toggleSortOptionsDialog}
|
|
|
|
sortBy={this.props.sortBy}
|
|
|
|
sortOrder={this.props.sortOrder}
|
|
|
|
sortItems={this.props.sortItems}
|
2018-11-28 12:41:49 +08:00
|
|
|
/>
|
2019-08-29 15:28:54 +08:00
|
|
|
}
|
2018-11-27 14:47:19 +08:00
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CurDirPath.propTypes = propTypes;
|
|
|
|
|
|
|
|
export default CurDirPath;
|