mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
[dir view] added 'sort' for mobile (#4032)
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { Utils } from '../../utils/utils';
|
||||||
|
import SortOptionsDialog from '../../components/dialog/sort-options';
|
||||||
import DirPath from './dir-path';
|
import DirPath from './dir-path';
|
||||||
import DirTool from './dir-tool';
|
import DirTool from './dir-tool';
|
||||||
|
|
||||||
@@ -19,7 +21,21 @@ const propTypes = {
|
|||||||
|
|
||||||
class CurDirPath extends React.Component {
|
class CurDirPath extends React.Component {
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = {
|
||||||
|
isSortOptionsDialogOpen: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleSortOptionsDialog = () => {
|
||||||
|
this.setState({
|
||||||
|
isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const isDesktop = Utils.isDesktop();
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<DirPath
|
<DirPath
|
||||||
@@ -32,6 +48,7 @@ class CurDirPath extends React.Component {
|
|||||||
isViewFile={this.props.isViewFile}
|
isViewFile={this.props.isViewFile}
|
||||||
fileTags={this.props.fileTags}
|
fileTags={this.props.fileTags}
|
||||||
/>
|
/>
|
||||||
|
{isDesktop &&
|
||||||
<DirTool
|
<DirTool
|
||||||
repoID={this.props.repoID}
|
repoID={this.props.repoID}
|
||||||
repoName={this.props.repoName}
|
repoName={this.props.repoName}
|
||||||
@@ -39,7 +56,17 @@ class CurDirPath extends React.Component {
|
|||||||
currentPath={this.props.currentPath}
|
currentPath={this.props.currentPath}
|
||||||
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
||||||
onDeleteRepoTag={this.props.onDeleteRepoTag}
|
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}
|
||||||
/>
|
/>
|
||||||
|
}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ const propTypes = {
|
|||||||
updateDirent: PropTypes.func.isRequired,
|
updateDirent: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
class MutipleDirOperationToolbar extends React.Component {
|
class MultipleDirOperationToolbar extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
@@ -409,6 +409,6 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MutipleDirOperationToolbar.propTypes = propTypes;
|
MultipleDirOperationToolbar.propTypes = propTypes;
|
||||||
|
|
||||||
export default MutipleDirOperationToolbar;
|
export default MultipleDirOperationToolbar;
|
@@ -95,6 +95,7 @@
|
|||||||
max-height: 40px;
|
max-height: 40px;
|
||||||
background:#f9f9f9;
|
background:#f9f9f9;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
}
|
}
|
||||||
|
@@ -191,6 +191,10 @@ class LibContentContainer extends React.Component {
|
|||||||
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
updateUsedRepoTags={this.props.updateUsedRepoTags}
|
||||||
fileTags={this.props.fileTags}
|
fileTags={this.props.fileTags}
|
||||||
onDeleteRepoTag={this.props.onDeleteRepoTag}
|
onDeleteRepoTag={this.props.onDeleteRepoTag}
|
||||||
|
direntList={this.props.direntList}
|
||||||
|
sortBy={this.props.sortBy}
|
||||||
|
sortOrder={this.props.sortOrder}
|
||||||
|
sortItems={this.props.sortItems}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className={`cur-view-content lib-content-container ${this.props.currentMode === 'column' ? 'view-mode-container' : ''}`} onScroll={this.onItemsScroll}>
|
<div className={`cur-view-content lib-content-container ${this.props.currentMode === 'column' ? 'view-mode-container' : ''}`} onScroll={this.onItemsScroll}>
|
||||||
|
@@ -5,7 +5,7 @@ import { gettext } from '../../utils/constants';
|
|||||||
import CommonToolbar from '../../components/toolbar/common-toolbar';
|
import CommonToolbar from '../../components/toolbar/common-toolbar';
|
||||||
import ViewModeToolbar from '../../components/toolbar/view-mode-toolbar';
|
import ViewModeToolbar from '../../components/toolbar/view-mode-toolbar';
|
||||||
import DirOperationToolBar from '../../components/toolbar/dir-operation-toolbar';
|
import DirOperationToolBar from '../../components/toolbar/dir-operation-toolbar';
|
||||||
import MutipleDirOperationToolbar from '../../components/toolbar/mutilple-dir-operation-toolbar';
|
import MultipleDirOperationToolbar from '../../components/toolbar/multiple-dir-operation-toolbar';
|
||||||
import ViewFileToolbar from '../../components/toolbar/view-file-toolbar';
|
import ViewFileToolbar from '../../components/toolbar/view-file-toolbar';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
@@ -89,7 +89,7 @@ class LibContentToolbar extends React.Component {
|
|||||||
<span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title={gettext('Side Nav Menu')} onClick={this.props.onSideNavMenuClick}></span>
|
<span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title={gettext('Side Nav Menu')} onClick={this.props.onSideNavMenuClick}></span>
|
||||||
<div className="dir-operation">
|
<div className="dir-operation">
|
||||||
{this.props.isDirentSelected ?
|
{this.props.isDirentSelected ?
|
||||||
<MutipleDirOperationToolbar
|
<MultipleDirOperationToolbar
|
||||||
repoID={this.props.repoID}
|
repoID={this.props.repoID}
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
userPerm={this.props.userPerm}
|
userPerm={this.props.userPerm}
|
||||||
|
@@ -159,7 +159,7 @@ class MyLibraries extends Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className="main-panel-center flex-row">
|
<div className="main-panel-center flex-row">
|
||||||
<div className="cur-view-container">
|
<div className="cur-view-container">
|
||||||
<div className="cur-view-path align-items-center">
|
<div className="cur-view-path">
|
||||||
<h3 className="sf-heading m-0">{gettext('My Libraries')}</h3>
|
<h3 className="sf-heading m-0">{gettext('My Libraries')}</h3>
|
||||||
{(!Utils.isDesktop() && this.state.repoList.length > 0) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
{(!Utils.isDesktop() && this.state.repoList.length > 0) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -8,7 +8,7 @@ import RepoInfo from '../../models/repo-info';
|
|||||||
import CommonToolbar from '../../components/toolbar/common-toolbar';
|
import CommonToolbar from '../../components/toolbar/common-toolbar';
|
||||||
import ViewModeToolbar from '../../components/toolbar/view-mode-toolbar';
|
import ViewModeToolbar from '../../components/toolbar/view-mode-toolbar';
|
||||||
import DirOperationToolBar from '../../components/toolbar/dir-operation-toolbar';
|
import DirOperationToolBar from '../../components/toolbar/dir-operation-toolbar';
|
||||||
import MutipleDirOperationToolbar from '../../components/toolbar/mutilple-dir-operation-toolbar';
|
import MultipleDirOperationToolbar from '../../components/toolbar/multiple-dir-operation-toolbar';
|
||||||
import CurDirPath from '../../components/cur-dir-path';
|
import CurDirPath from '../../components/cur-dir-path';
|
||||||
import WikiMarkdownViewer from '../../components/wiki-markdown-viewer';
|
import WikiMarkdownViewer from '../../components/wiki-markdown-viewer';
|
||||||
import DirentListView from '../../components/dirent-list-view/dirent-list-view';
|
import DirentListView from '../../components/dirent-list-view/dirent-list-view';
|
||||||
@@ -170,7 +170,7 @@ class MainPanel extends Component {
|
|||||||
<span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title={gettext('Side Nav Menu')} onClick={this.onSideNavMenuClick}></span>
|
<span className="sf2-icon-menu hidden-md-up d-md-none side-nav-toggle" title={gettext('Side Nav Menu')} onClick={this.onSideNavMenuClick}></span>
|
||||||
<div className="dir-operation">
|
<div className="dir-operation">
|
||||||
{this.props.isDirentSelected ?
|
{this.props.isDirentSelected ?
|
||||||
<MutipleDirOperationToolbar
|
<MultipleDirOperationToolbar
|
||||||
repoID={repoID}
|
repoID={repoID}
|
||||||
path={this.props.path}
|
path={this.props.path}
|
||||||
selectedDirentList={this.props.selectedDirentList}
|
selectedDirentList={this.props.selectedDirentList}
|
||||||
|
@@ -372,7 +372,7 @@ class SharedLibraries extends Component {
|
|||||||
<Fragment>
|
<Fragment>
|
||||||
<div className="main-panel-center">
|
<div className="main-panel-center">
|
||||||
<div className="cur-view-container">
|
<div className="cur-view-container">
|
||||||
<div className="cur-view-path align-items-center">
|
<div className="cur-view-path">
|
||||||
<h3 className="sf-heading m-0">{gettext('Shared with me')}</h3>
|
<h3 className="sf-heading m-0">{gettext('Shared with me')}</h3>
|
||||||
{(!Utils.isDesktop() && this.state.items.length > 0) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
{(!Utils.isDesktop() && this.state.items.length > 0) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -217,7 +217,7 @@ class PublicSharedView extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
<div className="main-panel-center">
|
<div className="main-panel-center">
|
||||||
<div className="cur-view-container">
|
<div className="cur-view-container">
|
||||||
<div className="cur-view-path align-items-center">
|
<div className="cur-view-path">
|
||||||
<h3 className="sf-heading m-0">{gettext('Shared with all')}</h3>
|
<h3 className="sf-heading m-0">{gettext('Shared with all')}</h3>
|
||||||
{(!Utils.isDesktop() && this.state.repoList.length > 0) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
{(!Utils.isDesktop() && this.state.repoList.length > 0) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user