1
0
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:
Aries
2024-10-14 10:18:40 +08:00
committed by GitHub
parent 52cccb5ce9
commit 600c6082c3
2 changed files with 11 additions and 2 deletions

View File

@@ -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>