Skip to content

Commit d15c50e

Browse files
committed
settings: Always show the sidebar in case of settings page.
Fixes #1077. Users were getting stuck in the settings page, unable to click on an organisation tab to go back. Enabling the sidebar for settings page in all cases will help ensure that the users can navigate back when needed.
1 parent 51ff949 commit d15c50e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app/renderer/js/main.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,6 +620,13 @@ export class ServerManagerView {
620620
});
621621
this.$settingsButton.classList.add("active");
622622
this.preferenceView!.handleNavigation(navigationItem);
623+
624+
// We need to call toggleSidebar again since we always want to show
625+
// the sidebar in case of the settings page. We still pass the real
626+
// config value for showSidebar so we do not reset showSidebar
627+
// if it was set to false by the user.
628+
const showSidebar = ConfigUtil.getConfigItem("showSidebar", true);
629+
this.toggleSidebar(showSidebar);
623630
}
624631

625632
async openAbout(): Promise<void> {
@@ -712,6 +719,12 @@ export class ServerManagerView {
712719
this.loading.has((await tab.webview).properties.url),
713720
);
714721

722+
// We might be coming here from the settings page, which has the
723+
// sidebar always enabled. We need to recheck that setting here
724+
// and toggle the sidebar as needed.
725+
const showSidebar = ConfigUtil.getConfigItem("showSidebar", true);
726+
this.toggleSidebar(showSidebar);
727+
715728
ipcRenderer.send("update-menu", {
716729
// JSON stringify this.tabs to avoid a crash
717730
// util.inspect is being used to handle circular references
@@ -791,6 +804,12 @@ export class ServerManagerView {
791804
}
792805

793806
toggleSidebar(show: boolean): void {
807+
ConfigUtil.setConfigItem("showSidebar", show);
808+
// We do not want to hide the sidebar in case of the settings page.
809+
if (this.tabs[this.activeTabIndex]?.properties?.page === "Settings") {
810+
show = true;
811+
}
812+
794813
this.$sidebar.classList.toggle("sidebar-hide", !show);
795814
}
796815

0 commit comments

Comments
 (0)