diff --git a/frontend/src/components/side-panel.js b/frontend/src/components/side-panel.js
index 649f341373..a2395a9a27 100644
--- a/frontend/src/components/side-panel.js
+++ b/frontend/src/components/side-panel.js
@@ -4,22 +4,26 @@ import Logo from './logo';
import MainSideNav from './main-side-nav';
const propTypes = {
- isSidePanelClosed: PropTypes.bool.isRequired,
- currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired,
- onCloseSidePanel: PropTypes.func.isRequired,
- tabItemClick: PropTypes.func.isRequired,
+ isSidePanelClosed: PropTypes.bool,
+ currentTab: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
+ onCloseSidePanel: PropTypes.func,
+ tabItemClick: PropTypes.func,
+ children: PropTypes.object
};
class SidePanel extends React.Component {
render() {
+ const { children } = this.props;
return (
-
+ {children ? children :
+
+ }
);
diff --git a/frontend/src/components/toolbar/common-toolbar.js b/frontend/src/components/toolbar/common-toolbar.js
index e95757f60b..c4686473be 100644
--- a/frontend/src/components/toolbar/common-toolbar.js
+++ b/frontend/src/components/toolbar/common-toolbar.js
@@ -13,10 +13,11 @@ const propTypes = {
path: PropTypes.string,
repoName: PropTypes.string,
isLibView: PropTypes.bool,
- onSearchedClick: PropTypes.func.isRequired,
+ onSearchedClick: PropTypes.func,
searchPlaceholder: PropTypes.string,
currentRepoInfo: PropTypes.object,
isViewFile: PropTypes.bool,
+ showSearch: PropTypes.bool
};
class CommonToolbar extends React.Component {
@@ -62,9 +63,10 @@ class CommonToolbar extends React.Component {
};
render() {
+ const { showSearch = true } = this.props;
return (
- {this.renderSearch()}
+ {showSearch && this.renderSearch()}
{showLogoutIcon && (
)}
diff --git a/frontend/src/components/toolbar/top-toolbar.js b/frontend/src/components/toolbar/top-toolbar.js
index 99e42ff584..4e0fa8a771 100644
--- a/frontend/src/components/toolbar/top-toolbar.js
+++ b/frontend/src/components/toolbar/top-toolbar.js
@@ -3,24 +3,29 @@ import PropTypes from 'prop-types';
import CommonToolbar from './common-toolbar';
const propTypes = {
- onShowSidePanel: PropTypes.func.isRequired,
- onSearchedClick: PropTypes.func.isRequired,
+ onShowSidePanel: PropTypes.func,
+ onSearchedClick: PropTypes.func,
searchPlaceholder: PropTypes.string,
- children: PropTypes.object
+ children: PropTypes.object,
+ showSearch: PropTypes.bool
};
class TopToolbar extends React.Component {
render() {
- const { onShowSidePanel, onSearchedClick } = this.props;
+ const { onShowSidePanel, onSearchedClick, children, showSearch } = this.props;
return (
-
+
{this.props.children}
-
+
);
}
diff --git a/frontend/src/components/user-settings/linked-devices.js b/frontend/src/components/user-settings/linked-devices.js
index eb1a256f3d..116d2bb608 100644
--- a/frontend/src/components/user-settings/linked-devices.js
+++ b/frontend/src/components/user-settings/linked-devices.js
@@ -225,7 +225,7 @@ class LinkedDevices extends Component {
return (
{gettext('Linked Devices')}
-
+
- {this.props.data.map((item, index) => {
- return item.show ?
- {item.text} : null;
- })}
-
+
+
+
+ {this.props.data.map((item, index) => {
+ return item.show ?
+ - {item.text}
: null;
+ })}
+
+
+
);
}
}
diff --git a/frontend/src/css/user-settings.css b/frontend/src/css/user-settings.css
index c3e489a4bf..f00ff8935b 100644
--- a/frontend/src/css/user-settings.css
+++ b/frontend/src/css/user-settings.css
@@ -4,52 +4,24 @@ body {
#wrapper {
height: 100%;
}
-.top-header {
- background: #f4f4f7;
- border-bottom: 1px solid #e8e8e8;
- padding: .5rem 1rem;
- flex-shrink: 0;
+
+.main-panel {
+ overflow: hidden;
}
-.side-panel {
- flex: 0 0 22%;
- padding: 1rem;
- border-right: 1px solid #eee;
-}
-.main-panel {
- flex: 1 0 78%;
-}
-.heading {
- padding: 8px 16px;
- background: #f9f9f9;
- font-size: 1rem;
- color: #212529;
- font-weight: normal;
- line-height: 1.5;
- margin:0;
- position: relative;
-}
-.heading:after {
- position: absolute;
- left: 16px;
- right: 16px;
- bottom: 0;
- content: '';
- border-bottom: 1px solid #e8e8e8;
-}
.content {
padding: 0rem 1rem 8rem;
overflow: auto;
}
.setting-item {
font-size: 0.875rem;
- margin: 1em 0 3em;
+ padding: 1em 0 3em;
}
.setting-item-heading {
font-size: 0.9375rem;
font-weight: normal;
padding-bottom: 0.3rem;
- border-bottom: 1px solid #ddd;
+ border-bottom: 1px solid #eee;
margin-bottom: 0.7rem;
}
.user-avatar {
@@ -69,20 +41,6 @@ body {
text-align: center;
cursor: pointer;
}
-.user-setting-nav .nav-item .nav-link {
- flex: auto;
- margin: 0;
- padding-left: 1em;
- border-left: 2px solid transparent;
- color: #212529;
-}
-.user-setting-nav .nav-item.active .nav-link {
- color: #ff9800;
- border-color: #ff9800;
-}
-.user-setting-nav .nav-item .nav-link:hover {
- color: #eb8205;
-}
.eye-icon {
color: #666;
}
diff --git a/frontend/src/settings.js b/frontend/src/settings.js
index 34f1a4fcb3..4131705feb 100644
--- a/frontend/src/settings.js
+++ b/frontend/src/settings.js
@@ -1,11 +1,14 @@
import React from 'react';
import ReactDom from 'react-dom';
-import { navigate } from '@gatsbyjs/reach-router';
+import MediaQuery from 'react-responsive';
+import { Modal } from 'reactstrap';
import { Utils } from './utils/utils';
-import { isPro, isDBSqlite3, gettext, siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle } from './utils/constants';
+import { isPro, isDBSqlite3, gettext, siteRoot } from './utils/constants';
import { seafileAPI } from './utils/seafile-api';
import toaster from './components/toast';
-import CommonToolbar from './components/toolbar/common-toolbar';
+import SidePanel from './components/side-panel';
+import MainPanel from './components/main-panel';
+import TopToolbar from './components/toolbar/top-toolbar';
import SideNav from './components/user-settings/side-nav';
import UserAvatarForm from './components/user-settings/user-avatar-form';
import UserBasicInfoForm from './components/user-settings/user-basic-info-form';
@@ -21,6 +24,7 @@ import SocialLoginSAML from './components/user-settings/social-login-saml';
import LinkedDevices from './components/user-settings/linked-devices';
import DeleteAccount from './components/user-settings/delete-account';
+import './css/layout.css';
import './css/toolbar.css';
import './css/search.css';
@@ -59,6 +63,7 @@ class Settings extends React.Component {
];
this.state = {
+ isSidePanelClosed: false,
curItemID: this.sideNavItems[0].href.substr(1)
};
}
@@ -86,17 +91,6 @@ class Settings extends React.Component {
});
};
- onSearchedClick = (selectedItem) => {
- if (selectedItem.is_dir === true) {
- let url = siteRoot + 'library/' + selectedItem.repo_id + '/' + selectedItem.repo_name + selectedItem.path;
- navigate(url, {repalce: true});
- } else {
- let url = siteRoot + 'lib/' + selectedItem.repo_id + '/file' + Utils.encodePath(selectedItem.path);
- let newWindow = window.open('about:blank');
- newWindow.location.href = url;
- }
- };
-
handleContentScroll = (e) => {
const scrollTop = e.target.scrollTop;
const scrolled = this.sideNavItems.filter((item, index) => {
@@ -109,50 +103,79 @@ class Settings extends React.Component {
}
};
+ onCloseSidePanel = () => {
+ this.setState({
+ isSidePanelClosed: !this.state.isSidePanelClosed
+ });
+ };
+
+ onShowSidePanel = () => {
+ this.setState({
+ isSidePanelClosed: !this.state.isSidePanelClosed
+ });
+ };
+
+ toggleSidePanel = () => {
+ this.setState({
+ isSidePanelClosed: !this.state.isSidePanelClosed
+ });
+ };
+
render() {
+ const { isSidePanelClosed } = this.state;
return (
-
-
-
-
-
-
-
-
{gettext('Settings')}
-
-
-
{gettext('Profile Setting')}
-
- {this.state.userInfo &&
}
+
+
+
+
+
+ <>
+
+
+
+
+
+
{gettext('Settings')}
+
+
+
+
{gettext('Profile Setting')}
+
+ {this.state.userInfo && }
+
+ {canUpdatePassword &&
+
+ }
+ {enableGetAuthToken &&
}
+ {enableWebdavSecret &&
}
+ {enableAddressBook && this.state.userInfo &&
+
}
+
+ {(isPro || !isDBSqlite3) &&
}
+ {twoFactorAuthEnabled &&
}
+ {enableWechatWork &&
}
+ {enableDingtalk &&
}
+ {(enableADFS || (enableMultiADFS && isOrgContext)) &&
}
+
+ {enableDeleteAccount &&
}
+
- {canUpdatePassword &&
-
- }
-
- {enableGetAuthToken &&
}
- {enableWebdavSecret &&
}
- {enableAddressBook && this.state.userInfo &&
-
}
-
- {(isPro || !isDBSqlite3) &&
}
- {twoFactorAuthEnabled &&
}
- {enableWechatWork &&
}
- {enableDingtalk &&
}
- {(enableADFS || (enableMultiADFS && isOrgContext)) &&
}
-
- {enableDeleteAccount &&
}
-
-
+ >
+
+
+
+
);