From 168c0992a7f75d38365860eb989ae70319a412c3 Mon Sep 17 00:00:00 2001 From: llj Date: Thu, 18 Jul 2019 20:21:50 +0800 Subject: [PATCH] [shared with all, group, groups] mobile: improvement (#3874) * added component libs-mobile-thead.js --- frontend/src/components/libs-mobile-thead.js | 16 ++++++++++++++ .../shared-repo-list-item.js | 2 +- .../shared-repo-list-view.js | 19 +++-------------- frontend/src/pages/groups/group-view.js | 17 +++++++++++++++ .../src/pages/my-libs/mylib-repo-list-view.js | 9 ++------ frontend/src/pages/shared-libs/shared-libs.js | 13 ++---------- .../shared-with-all/public-shared-view.js | 21 +++++++++++++++++-- 7 files changed, 60 insertions(+), 37 deletions(-) create mode 100644 frontend/src/components/libs-mobile-thead.js diff --git a/frontend/src/components/libs-mobile-thead.js b/frontend/src/components/libs-mobile-thead.js new file mode 100644 index 0000000000..bac8e762ef --- /dev/null +++ b/frontend/src/components/libs-mobile-thead.js @@ -0,0 +1,16 @@ +import React from 'react'; +import { gettext } from '../utils/constants'; + +function LibsMobileThead() { + return ( + + + {gettext('Library Type')} + + {gettext('Actions')} + + + ); +} + +export default LibsMobileThead; diff --git a/frontend/src/components/shared-repo-list-view/shared-repo-list-item.js b/frontend/src/components/shared-repo-list-view/shared-repo-list-item.js index ed09527fc2..b77ff1d7fb 100644 --- a/frontend/src/components/shared-repo-list-view/shared-repo-list-item.js +++ b/frontend/src/components/shared-repo-list-view/shared-repo-list-item.js @@ -273,7 +273,7 @@ class SharedRepoListItem extends React.Component { { - let isShowTableThread = this.props.isShowTableThread !== undefined ? this.props.isShowTableThread : true; - - const { sortByName, sortByTime, sortIcon } = this.getSortMetaData(); - return ( - - - - - - - - +
{gettext('Library Type')} - {gettext('Sort:')} - {gettext('name')} {sortByName && sortIcon} - {gettext('last update')} {sortByTime && sortIcon} - {gettext('Actions')}
+ {this.renderRepoListView()} diff --git a/frontend/src/pages/groups/group-view.js b/frontend/src/pages/groups/group-view.js index 25487d2223..12a2462bfe 100644 --- a/frontend/src/pages/groups/group-view.js +++ b/frontend/src/pages/groups/group-view.js @@ -23,6 +23,7 @@ import ManageMembersDialog from '../../components/dialog/manage-members-dialog'; import LeaveGroupDialog from '../../components/dialog/leave-group-dialog'; import SharedRepoListView from '../../components/shared-repo-list-view/shared-repo-list-view'; import LibDetail from '../../components/dirent-detail/lib-details'; +import SortOptionsDialog from '../../components/dialog/sort-options'; import '../../css/group-view.css'; @@ -48,6 +49,7 @@ class GroupView extends React.Component { isOwner: false, sortBy: cookie.load('seafile-repo-dir-sort-by') || 'name', // 'name' or 'time' or 'size' sortOrder: cookie.load('seafile-repo-dir-sort-order') || 'asc', // 'asc' or 'desc' + isSortOptionsDialogOpen: false, repoList: [], libraryType: 'group', isCreateRepoDialogShow: false, @@ -382,6 +384,12 @@ class GroupView extends React.Component { } } + toggleSortOptionsDialog = () => { + this.setState({ + isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen + }); + } + render() { let { errMessage, emptyTip, currentGroup, isDepartmentGroup, isStaff } = this.state; let isShowSettingIcon = !(currentGroup && currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1); @@ -501,6 +509,15 @@ class GroupView extends React.Component { + {(window.innerWidth < 768) && } + {this.state.isSortOptionsDialogOpen && + + } )} diff --git a/frontend/src/pages/my-libs/mylib-repo-list-view.js b/frontend/src/pages/my-libs/mylib-repo-list-view.js index c90aa983b3..11f502c5e9 100644 --- a/frontend/src/pages/my-libs/mylib-repo-list-view.js +++ b/frontend/src/pages/my-libs/mylib-repo-list-view.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import MediaQuery from 'react-responsive'; import { gettext, storages } from '../../utils/constants'; import MylibRepoListItem from './mylib-repo-list-item'; +import LibsMobileThead from '../../components/libs-mobile-thead'; const propTypes = { sortBy: PropTypes.string.isRequired, @@ -101,13 +102,7 @@ class MylibRepoListView extends React.Component { renderMobileUI = () => { return (
- - - - - - - + {this.renderRepoListView()} diff --git a/frontend/src/pages/shared-libs/shared-libs.js b/frontend/src/pages/shared-libs/shared-libs.js index 3ada8355fb..011bd8327e 100644 --- a/frontend/src/pages/shared-libs/shared-libs.js +++ b/frontend/src/pages/shared-libs/shared-libs.js @@ -11,6 +11,7 @@ import toaster from '../../components/toast'; import Repo from '../../models/repo'; import Loading from '../../components/loading'; import EmptyTip from '../../components/empty-tip'; +import LibsMobileThead from '../../components/libs-mobile-thead'; import ModalPotal from '../../components/modal-portal'; import ShareDialog from '../../components/dialog/share-dialog'; import SortOptionsDialog from '../../components/dialog/sort-options'; @@ -73,19 +74,9 @@ class Content extends Component { ); - const mobileThead = ( - - - - - - - - ); - const table = (
{gettext('Library Type')}{gettext('Actions')}
{gettext('Library Type')}{gettext('Actions')}
= 768 ? '' : 'table-thead-hidden'}> - {window.innerWidth >= 768 ? desktopThead : mobileThead} + {window.innerWidth >= 768 ? desktopThead : }
); diff --git a/frontend/src/pages/shared-with-all/public-shared-view.js b/frontend/src/pages/shared-with-all/public-shared-view.js index e37713bb03..e58b2bbb87 100644 --- a/frontend/src/pages/shared-with-all/public-shared-view.js +++ b/frontend/src/pages/shared-with-all/public-shared-view.js @@ -15,6 +15,7 @@ import CommonToolbar from '../../components/toolbar/common-toolbar'; import CreateRepoDialog from '../../components/dialog/create-repo-dialog'; import ShareRepoDialog from '../../components/dialog/share-repo-dialog'; import SharedRepoListView from '../../components/shared-repo-list-view/shared-repo-list-view'; +import SortOptionsDialog from '../../components/dialog/sort-options'; const propTypes = { onShowSidePanel: PropTypes.func.isRequired, @@ -32,6 +33,7 @@ class PublicSharedView extends React.Component { repoList: [], sortBy: cookie.load('seafile-repo-dir-sort-by') || 'name', // 'name' or 'time' or 'size' sortOrder: cookie.load('seafile-repo-dir-sort-order') || 'asc', // 'asc' or 'desc' + isSortOptionsDialogOpen: false, libraryType: 'public', isCreateMenuShow: false, isCreateRepoDialogShow: false, @@ -169,6 +171,12 @@ class PublicSharedView extends React.Component { }); } + toggleSortOptionsDialog = () => { + this.setState({ + isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen + }); + } + render() { let errMessage = this.state.errMessage; let emptyTip = ( @@ -207,8 +215,9 @@ class PublicSharedView extends React.Component {
-
-

{gettext('Shared with all')}

+
+

{gettext('Shared with all')}

+ {(window.innerWidth < 768) && }
{this.state.isLoading && } @@ -228,6 +237,14 @@ class PublicSharedView extends React.Component {
+ {this.state.isSortOptionsDialogOpen && + + } {this.state.isCreateRepoDialogShow && (