mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-03 07:55:36 +00:00
update title when jump from view to folder (#6886)
* update title when jump from view to folder * reset title when leave view page * remove warnings --------- Co-authored-by: zhouwenxuan <aries@Mac.local> Co-authored-by: Michael An <2331806369@qq.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import ReactDom from 'react-dom';
|
||||
import { Router, navigate } from '@gatsbyjs/reach-router';
|
||||
import MediaQuery from 'react-responsive';
|
||||
import { Modal } from 'reactstrap';
|
||||
import { siteRoot } from './utils/constants';
|
||||
import { siteRoot, siteTitle, mediaUrl, faviconPath } from './utils/constants';
|
||||
import { Utils, isMobile } from './utils/utils';
|
||||
import SystemNotification from './components/system-notification';
|
||||
import EventBus from './components/common/event-bus';
|
||||
@@ -105,6 +105,12 @@ class App extends Component {
|
||||
this.setState({ currentTab: currentTab });
|
||||
}
|
||||
|
||||
resetTitle = () => {
|
||||
const favicon = document.getElementById('favicon');
|
||||
favicon.href = `${mediaUrl}${faviconPath}`;
|
||||
document.title = siteTitle;
|
||||
};
|
||||
|
||||
onCloseSidePanel = () => {
|
||||
this.setState({
|
||||
isSidePanelClosed: !this.state.isSidePanelClosed
|
||||
@@ -162,6 +168,7 @@ class App extends Component {
|
||||
if (!Utils.isDesktop() && !this.state.isSidePanelClosed) {
|
||||
this.setState({ isSidePanelClosed: true });
|
||||
}
|
||||
this.resetTitle();
|
||||
};
|
||||
|
||||
generatorPrefix = (tabName, groupID) => {
|
||||
@@ -337,6 +344,7 @@ class App extends Component {
|
||||
isSidePanelFolded={isSidePanelFolded}
|
||||
onTabNavClick={this.tabItemClick}
|
||||
eventBus={this.eventBus}
|
||||
resetTitle={this.resetTitle}
|
||||
/>
|
||||
</Router>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user