1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 07:01:12 +00:00

12.0 change app structure (#6335)

* 01 change app structure

* 02 change setting page

* 03 optimize header style

* 04 change app mobile side panel logo
This commit is contained in:
Michael An
2024-07-11 17:45:30 +08:00
committed by GitHub
parent 4e16703d33
commit c41407f783
38 changed files with 238 additions and 408 deletions

View File

@@ -7,6 +7,7 @@ import SearchByName from '../search/search-by-name';
import Notification from '../common/notification';
import Account from '../common/account';
import Logout from '../common/logout';
import { EVENT_BUS_TYPE } from '../common/event-bus-type';
const propTypes = {
repoID: PropTypes.string,
@@ -16,14 +17,41 @@ const propTypes = {
onSearchedClick: PropTypes.func,
searchPlaceholder: PropTypes.string,
currentRepoInfo: PropTypes.object,
eventBus: PropTypes.object,
isViewFile: PropTypes.bool,
showSearch: PropTypes.bool
};
class CommonToolbar extends React.Component {
constructor(props) {
super(props);
this.state = {
repoID: props.repoID,
repoName: props.repoName,
isLibView: props.isLibView,
path: props.path,
isViewFile: props.isViewFile,
};
}
componentDidMount() {
if (this.props.eventBus) {
this.unsubscribeLibChange = this.props.eventBus.subscribe(EVENT_BUS_TYPE.CURRENT_LIBRARY_CHANGED, this.onRepoChange);
}
}
componentWillUnmount() {
this.unsubscribeLibChange && this.unsubscribeLibChange();
}
onRepoChange = ({ repoID, repoName, isLibView, path, isViewFile }) => {
this.setState({ repoID, repoName, isLibView, path, isViewFile });
};
renderSearch = () => {
const { repoID, repoName, isLibView, searchPlaceholder, path, isViewFile } = this.props;
const { repoID, repoName, isLibView, path, isViewFile } = this.state;
const { searchPlaceholder } = this.props;
const placeholder = searchPlaceholder || gettext('Search files');
if (isPro) {

View File

@@ -1,36 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import CommonToolbar from './common-toolbar';
const propTypes = {
searchPlaceholder: PropTypes.string,
onShowSidePanel: PropTypes.func.isRequired,
onSearchedClick: PropTypes.func.isRequired,
};
class GeneralToolbar extends React.Component {
render() {
// todo get repoID?
let { onShowSidePanel, onSearchedClick } = this.props;
return (
<div className="main-panel-north">
<div className="cur-view-toolbar">
<span
className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none"
title="Side Nav Menu"
onClick={onShowSidePanel}>
</span>
</div>
<CommonToolbar
searchPlaceholder={this.props.searchPlaceholder}
onSearchedClick={onSearchedClick}
/>
</div>
);
}
}
GeneralToolbar.propTypes = propTypes;
export default GeneralToolbar;

View File

@@ -1,36 +0,0 @@
import React from 'react';
import PropTypes from 'prop-types';
import CommonToolbar from './common-toolbar';
const propTypes = {
onShowSidePanel: PropTypes.func,
onSearchedClick: PropTypes.func,
searchPlaceholder: PropTypes.string,
children: PropTypes.object,
showSearch: PropTypes.bool
};
class TopToolbar extends React.Component {
render() {
const { onShowSidePanel, onSearchedClick, children, showSearch } = this.props;
return (
<div className={`main-panel-north ${children ? 'border-left-show' : ''}`}>
<div className="cur-view-toolbar">
<span title="Side Nav Menu" onClick={onShowSidePanel} className="sf2-icon-menu side-nav-toggle hidden-md-up d-md-none">
</span>
{this.props.children}
</div>
<CommonToolbar
showSearch={showSearch}
searchPlaceholder={this.props.searchPlaceholder}
onSearchedClick={onSearchedClick}
/>
</div>
);
}
}
TopToolbar.propTypes = propTypes;
export default TopToolbar;