1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-06 09:21:54 +00:00
Files
seahub/frontend/src/components/cur-dir-path/index.js

82 lines
2.4 KiB
JavaScript
Raw Normal View History

import React, { Fragment } from 'react';
import PropTypes from 'prop-types';
import { Utils } from '../../utils/utils';
import SortOptionsDialog from '../../components/dialog/sort-options';
import DirPath from './dir-path';
import DirTool from './dir-tool';
const propTypes = {
2018-11-28 12:41:49 +08:00
repoID: PropTypes.string.isRequired,
repoName: PropTypes.string.isRequired,
userPerm: PropTypes.string,
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,
updateUsedRepoTags: PropTypes.func.isRequired,
fileTags: PropTypes.array.isRequired,
onDeleteRepoTag: PropTypes.func.isRequired,
direntList: PropTypes.array,
sortBy: PropTypes.string,
sortOrder: PropTypes.string,
sortItems: PropTypes.array,
};
class CurDirPath extends React.Component {
constructor(props) {
super(props);
this.state = {
isSortOptionsDialogOpen: false
};
}
toggleSortOptionsDialog = () => {
this.setState({
isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen
});
};
render() {
const isDesktop = Utils.isDesktop();
return (
<Fragment>
<DirPath
repoName={this.props.repoName}
2018-12-11 17:52:19 +08:00
pathPrefix={this.props.pathPrefix}
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}
fileTags={this.props.fileTags}
/>
{isDesktop &&
<DirTool
2018-11-28 12:41:49 +08:00
repoID={this.props.repoID}
repoName={this.props.repoName}
userPerm={this.props.userPerm}
currentPath={this.props.currentPath}
updateUsedRepoTags={this.props.updateUsedRepoTags}
onDeleteRepoTag={this.props.onDeleteRepoTag}
/>}
{!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
/>
}
</Fragment>
);
}
}
CurDirPath.propTypes = propTypes;
export default CurDirPath;