Fix top bar theme when changing the system settings (#2821)

This commit is contained in:
Daniel Espino García
2023-09-06 22:58:19 +02:00
committed by GitHub
parent 32223fa3e1
commit 5afc8e738c

View File

@@ -54,7 +54,6 @@ type State = {
mentionCounts: Record<string, number>; mentionCounts: Record<string, number>;
maximized: boolean; maximized: boolean;
tabViewStatus: Map<string, TabViewStatus>; tabViewStatus: Map<string, TabViewStatus>;
darkMode: boolean;
modalOpen?: boolean; modalOpen?: boolean;
fullScreen?: boolean; fullScreen?: boolean;
showExtraBar?: boolean; showExtraBar?: boolean;
@@ -91,7 +90,6 @@ class MainPage extends React.PureComponent<Props, State> {
mentionCounts: {}, mentionCounts: {},
maximized: false, maximized: false,
tabViewStatus: new Map(), tabViewStatus: new Map(),
darkMode: this.props.darkMode,
isMenuOpen: false, isMenuOpen: false,
isDownloadsDropdownOpen: false, isDownloadsDropdownOpen: false,
showDownloadsBadge: false, showDownloadsBadge: false,
@@ -194,10 +192,6 @@ class MainPage extends React.PureComponent<Props, State> {
this.updateTabStatus(viewId, statusValue); this.updateTabStatus(viewId, statusValue);
}); });
window.desktop.onDarkModeChange((darkMode) => {
this.setState({darkMode});
});
// can't switch tabs sequentially for some reason... // can't switch tabs sequentially for some reason...
window.desktop.onSetActiveView(this.setActiveView); window.desktop.onSetActiveView(this.setActiveView);
@@ -407,7 +401,7 @@ class MainPage extends React.PureComponent<Props, State> {
const tabsRow = ( const tabsRow = (
<TabBar <TabBar
id='tabBar' id='tabBar'
isDarkMode={this.state.darkMode} isDarkMode={this.props.darkMode}
tabs={currentTabs} tabs={currentTabs}
sessionsExpired={this.state.sessionsExpired} sessionsExpired={this.state.sessionsExpired}
unreadCounts={this.state.unreadCounts} unreadCounts={this.state.unreadCounts}
@@ -424,13 +418,13 @@ class MainPage extends React.PureComponent<Props, State> {
const topBarClassName = classNames('topBar', { const topBarClassName = classNames('topBar', {
macOS: window.process.platform === 'darwin', macOS: window.process.platform === 'darwin',
darkMode: this.state.darkMode, darkMode: this.props.darkMode,
fullScreen: this.state.fullScreen, fullScreen: this.state.fullScreen,
}); });
const downloadsDropdownButton = this.state.hasDownloads ? ( const downloadsDropdownButton = this.state.hasDownloads ? (
<DownloadsDropdownButton <DownloadsDropdownButton
darkMode={this.state.darkMode} darkMode={this.props.darkMode}
isDownloadsDropdownOpen={this.state.isDownloadsDropdownOpen} isDownloadsDropdownOpen={this.state.isDownloadsDropdownOpen}
showDownloadsBadge={this.state.showDownloadsBadge} showDownloadsBadge={this.state.showDownloadsBadge}
closeDownloadsDropdown={this.closeDownloadsDropdown} closeDownloadsDropdown={this.closeDownloadsDropdown}
@@ -544,7 +538,7 @@ class MainPage extends React.PureComponent<Props, State> {
totalMentionCount={totalMentionCount} totalMentionCount={totalMentionCount}
hasUnreads={hasAnyUnreads} hasUnreads={hasAnyUnreads}
isMenuOpen={this.state.isMenuOpen} isMenuOpen={this.state.isMenuOpen}
darkMode={this.state.darkMode} darkMode={this.props.darkMode}
/> />
)} )}
{tabsRow} {tabsRow}
@@ -589,7 +583,7 @@ class MainPage extends React.PureComponent<Props, State> {
const viewsRow = ( const viewsRow = (
<Fragment> <Fragment>
<ExtraBar <ExtraBar
darkMode={this.state.darkMode} darkMode={this.props.darkMode}
show={this.state.showExtraBar} show={this.state.showExtraBar}
goBack={() => { goBack={() => {
window.desktop.goBack(); window.desktop.goBack();