mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 10:50:24 +00:00
[shared with all, group, groups] mobile: improvement (#3874)
* added component libs-mobile-thead.js
This commit is contained in:
16
frontend/src/components/libs-mobile-thead.js
Normal file
16
frontend/src/components/libs-mobile-thead.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { gettext } from '../utils/constants';
|
||||||
|
|
||||||
|
function LibsMobileThead() {
|
||||||
|
return (
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="12%"><span className="sr-only">{gettext('Library Type')}</span></th>
|
||||||
|
<th width="80%"></th>
|
||||||
|
<th width="8%"><span className="sr-only">{gettext('Actions')}</span></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default LibsMobileThead;
|
@@ -273,7 +273,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
<Dropdown isOpen={this.state.isItemMenuShow} toggle={this.toggleOperationMenu}>
|
<Dropdown isOpen={this.state.isItemMenuShow} toggle={this.toggleOperationMenu}>
|
||||||
<DropdownToggle
|
<DropdownToggle
|
||||||
tag="i"
|
tag="i"
|
||||||
className="sf-dropdown-toggle sf2-icon-caret-down"
|
className="sf-dropdown-toggle fa fa-ellipsis-v ml-0"
|
||||||
title={gettext('More Operations')}
|
title={gettext('More Operations')}
|
||||||
data-toggle="dropdown"
|
data-toggle="dropdown"
|
||||||
aria-expanded={this.state.isItemMenuShow}
|
aria-expanded={this.state.isItemMenuShow}
|
||||||
|
@@ -4,6 +4,7 @@ import { gettext } from '../../utils/constants';
|
|||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import SharedRepoListItem from './shared-repo-list-item';
|
import SharedRepoListItem from './shared-repo-list-item';
|
||||||
import toaster from '../toast';
|
import toaster from '../toast';
|
||||||
|
import LibsMobileThead from '../libs-mobile-thead';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
libraryType: PropTypes.string,
|
libraryType: PropTypes.string,
|
||||||
@@ -129,23 +130,9 @@ class SharedRepoListView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderMobileUI = () => {
|
renderMobileUI = () => {
|
||||||
let isShowTableThread = this.props.isShowTableThread !== undefined ? this.props.isShowTableThread : true;
|
|
||||||
|
|
||||||
const { sortByName, sortByTime, sortIcon } = this.getSortMetaData();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<table className={isShowTableThread ? '' : 'table-thead-hidden'}>
|
<table className="table-thead-hidden">
|
||||||
<thead>
|
<LibsMobileThead />
|
||||||
<tr>
|
|
||||||
<th width="18%"><span className="sr-only">{gettext('Library Type')}</span></th>
|
|
||||||
<th width="68%">
|
|
||||||
{gettext('Sort:')}
|
|
||||||
<a className="table-sort-op" href="#" onClick={this.sortByName}>{gettext('name')} {sortByName && sortIcon}</a>
|
|
||||||
<a className="table-sort-op" href="#" onClick={this.sortByTime}>{gettext('last update')} {sortByTime && sortIcon}</a>
|
|
||||||
</th>
|
|
||||||
<th width="14%"><span className="sr-only">{gettext('Actions')}</span></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{this.renderRepoListView()}
|
{this.renderRepoListView()}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@@ -23,6 +23,7 @@ import ManageMembersDialog from '../../components/dialog/manage-members-dialog';
|
|||||||
import LeaveGroupDialog from '../../components/dialog/leave-group-dialog';
|
import LeaveGroupDialog from '../../components/dialog/leave-group-dialog';
|
||||||
import SharedRepoListView from '../../components/shared-repo-list-view/shared-repo-list-view';
|
import SharedRepoListView from '../../components/shared-repo-list-view/shared-repo-list-view';
|
||||||
import LibDetail from '../../components/dirent-detail/lib-details';
|
import LibDetail from '../../components/dirent-detail/lib-details';
|
||||||
|
import SortOptionsDialog from '../../components/dialog/sort-options';
|
||||||
|
|
||||||
import '../../css/group-view.css';
|
import '../../css/group-view.css';
|
||||||
|
|
||||||
@@ -48,6 +49,7 @@ class GroupView extends React.Component {
|
|||||||
isOwner: false,
|
isOwner: false,
|
||||||
sortBy: cookie.load('seafile-repo-dir-sort-by') || 'name', // 'name' or 'time' or 'size'
|
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'
|
sortOrder: cookie.load('seafile-repo-dir-sort-order') || 'asc', // 'asc' or 'desc'
|
||||||
|
isSortOptionsDialogOpen: false,
|
||||||
repoList: [],
|
repoList: [],
|
||||||
libraryType: 'group',
|
libraryType: 'group',
|
||||||
isCreateRepoDialogShow: false,
|
isCreateRepoDialogShow: false,
|
||||||
@@ -382,6 +384,12 @@ class GroupView extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleSortOptionsDialog = () => {
|
||||||
|
this.setState({
|
||||||
|
isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let { errMessage, emptyTip, currentGroup, isDepartmentGroup, isStaff } = this.state;
|
let { errMessage, emptyTip, currentGroup, isDepartmentGroup, isStaff } = this.state;
|
||||||
let isShowSettingIcon = !(currentGroup && currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1);
|
let isShowSettingIcon = !(currentGroup && currentGroup.parent_group_id !== 0 && currentGroup.admins.indexOf(username) === -1);
|
||||||
@@ -501,6 +509,15 @@ class GroupView extends React.Component {
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
{(window.innerWidth < 768) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
||||||
|
{this.state.isSortOptionsDialogOpen &&
|
||||||
|
<SortOptionsDialog
|
||||||
|
toggleDialog={this.toggleSortOptionsDialog}
|
||||||
|
sortBy={this.state.sortBy}
|
||||||
|
sortOrder={this.state.sortOrder}
|
||||||
|
sortItems={this.sortItems}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</Fragment>
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
|
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import MediaQuery from 'react-responsive';
|
import MediaQuery from 'react-responsive';
|
||||||
import { gettext, storages } from '../../utils/constants';
|
import { gettext, storages } from '../../utils/constants';
|
||||||
import MylibRepoListItem from './mylib-repo-list-item';
|
import MylibRepoListItem from './mylib-repo-list-item';
|
||||||
|
import LibsMobileThead from '../../components/libs-mobile-thead';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
sortBy: PropTypes.string.isRequired,
|
sortBy: PropTypes.string.isRequired,
|
||||||
@@ -101,13 +102,7 @@ class MylibRepoListView extends React.Component {
|
|||||||
renderMobileUI = () => {
|
renderMobileUI = () => {
|
||||||
return (
|
return (
|
||||||
<table className="table-thead-hidden">
|
<table className="table-thead-hidden">
|
||||||
<thead>
|
<LibsMobileThead />
|
||||||
<tr>
|
|
||||||
<th width="12%"><span className="sr-only">{gettext('Library Type')}</span></th>
|
|
||||||
<th width="80%"></th>
|
|
||||||
<th width="8%"><span className="sr-only">{gettext('Actions')}</span></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{this.renderRepoListView()}
|
{this.renderRepoListView()}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
@@ -11,6 +11,7 @@ import toaster from '../../components/toast';
|
|||||||
import Repo from '../../models/repo';
|
import Repo from '../../models/repo';
|
||||||
import Loading from '../../components/loading';
|
import Loading from '../../components/loading';
|
||||||
import EmptyTip from '../../components/empty-tip';
|
import EmptyTip from '../../components/empty-tip';
|
||||||
|
import LibsMobileThead from '../../components/libs-mobile-thead';
|
||||||
import ModalPotal from '../../components/modal-portal';
|
import ModalPotal from '../../components/modal-portal';
|
||||||
import ShareDialog from '../../components/dialog/share-dialog';
|
import ShareDialog from '../../components/dialog/share-dialog';
|
||||||
import SortOptionsDialog from '../../components/dialog/sort-options';
|
import SortOptionsDialog from '../../components/dialog/sort-options';
|
||||||
@@ -73,19 +74,9 @@ class Content extends Component {
|
|||||||
</thead>
|
</thead>
|
||||||
);
|
);
|
||||||
|
|
||||||
const mobileThead = (
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th width="12%"><span className="sr-only">{gettext('Library Type')}</span></th>
|
|
||||||
<th width="80%"></th>
|
|
||||||
<th width="8%"><span className="sr-only">{gettext('Actions')}</span></th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
);
|
|
||||||
|
|
||||||
const table = (
|
const table = (
|
||||||
<table className={window.innerWidth >= 768 ? '' : 'table-thead-hidden'}>
|
<table className={window.innerWidth >= 768 ? '' : 'table-thead-hidden'}>
|
||||||
{window.innerWidth >= 768 ? desktopThead : mobileThead}
|
{window.innerWidth >= 768 ? desktopThead : <LibsMobileThead />}
|
||||||
<TableBody items={items} />
|
<TableBody items={items} />
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
|
@@ -15,6 +15,7 @@ import CommonToolbar from '../../components/toolbar/common-toolbar';
|
|||||||
import CreateRepoDialog from '../../components/dialog/create-repo-dialog';
|
import CreateRepoDialog from '../../components/dialog/create-repo-dialog';
|
||||||
import ShareRepoDialog from '../../components/dialog/share-repo-dialog';
|
import ShareRepoDialog from '../../components/dialog/share-repo-dialog';
|
||||||
import SharedRepoListView from '../../components/shared-repo-list-view/shared-repo-list-view';
|
import SharedRepoListView from '../../components/shared-repo-list-view/shared-repo-list-view';
|
||||||
|
import SortOptionsDialog from '../../components/dialog/sort-options';
|
||||||
|
|
||||||
const propTypes = {
|
const propTypes = {
|
||||||
onShowSidePanel: PropTypes.func.isRequired,
|
onShowSidePanel: PropTypes.func.isRequired,
|
||||||
@@ -32,6 +33,7 @@ class PublicSharedView extends React.Component {
|
|||||||
repoList: [],
|
repoList: [],
|
||||||
sortBy: cookie.load('seafile-repo-dir-sort-by') || 'name', // 'name' or 'time' or 'size'
|
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'
|
sortOrder: cookie.load('seafile-repo-dir-sort-order') || 'asc', // 'asc' or 'desc'
|
||||||
|
isSortOptionsDialogOpen: false,
|
||||||
libraryType: 'public',
|
libraryType: 'public',
|
||||||
isCreateMenuShow: false,
|
isCreateMenuShow: false,
|
||||||
isCreateRepoDialogShow: false,
|
isCreateRepoDialogShow: false,
|
||||||
@@ -169,6 +171,12 @@ class PublicSharedView extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toggleSortOptionsDialog = () => {
|
||||||
|
this.setState({
|
||||||
|
isSortOptionsDialogOpen: !this.state.isSortOptionsDialogOpen
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let errMessage = this.state.errMessage;
|
let errMessage = this.state.errMessage;
|
||||||
let emptyTip = (
|
let emptyTip = (
|
||||||
@@ -207,8 +215,9 @@ 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">
|
<div className="cur-view-path align-items-center">
|
||||||
<h3 className="sf-heading">{gettext('Shared with all')}</h3>
|
<h3 className="sf-heading m-0">{gettext('Shared with all')}</h3>
|
||||||
|
{(window.innerWidth < 768) && <span className="sf3-font sf3-font-sort action-icon" onClick={this.toggleSortOptionsDialog}></span>}
|
||||||
</div>
|
</div>
|
||||||
<div className="cur-view-content">
|
<div className="cur-view-content">
|
||||||
{this.state.isLoading && <Loading />}
|
{this.state.isLoading && <Loading />}
|
||||||
@@ -228,6 +237,14 @@ class PublicSharedView extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{this.state.isSortOptionsDialogOpen &&
|
||||||
|
<SortOptionsDialog
|
||||||
|
toggleDialog={this.toggleSortOptionsDialog}
|
||||||
|
sortBy={this.state.sortBy}
|
||||||
|
sortOrder={this.state.sortOrder}
|
||||||
|
sortItems={this.sortItems}
|
||||||
|
/>
|
||||||
|
}
|
||||||
{this.state.isCreateRepoDialogShow && (
|
{this.state.isCreateRepoDialogShow && (
|
||||||
<ModalPortal>
|
<ModalPortal>
|
||||||
<CreateRepoDialog
|
<CreateRepoDialog
|
||||||
|
Reference in New Issue
Block a user