From d15c50eb7b739bf9c53ed8076026fbb84ccd0fea Mon Sep 17 00:00:00 2001 From: Shubham Padia Date: Thu, 19 Jun 2025 13:55:43 +0530 Subject: [PATCH] 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. --- app/renderer/js/main.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/renderer/js/main.ts b/app/renderer/js/main.ts index 861074738..fa820b227 100644 --- a/app/renderer/js/main.ts +++ b/app/renderer/js/main.ts @@ -620,6 +620,13 @@ export class ServerManagerView { }); this.$settingsButton.classList.add("active"); this.preferenceView!.handleNavigation(navigationItem); + + // We need to call toggleSidebar again since we always want to show + // the sidebar in case of the settings page. We still pass the real + // config value for showSidebar so we do not reset showSidebar + // if it was set to false by the user. + const showSidebar = ConfigUtil.getConfigItem("showSidebar", true); + this.toggleSidebar(showSidebar); } async openAbout(): Promise { @@ -712,6 +719,12 @@ export class ServerManagerView { this.loading.has((await tab.webview).properties.url), ); + // We might be coming here from the settings page, which has the + // sidebar always enabled. We need to recheck that setting here + // and toggle the sidebar as needed. + const showSidebar = ConfigUtil.getConfigItem("showSidebar", true); + this.toggleSidebar(showSidebar); + ipcRenderer.send("update-menu", { // JSON stringify this.tabs to avoid a crash // util.inspect is being used to handle circular references @@ -791,6 +804,12 @@ export class ServerManagerView { } toggleSidebar(show: boolean): void { + ConfigUtil.setConfigItem("showSidebar", show); + // We do not want to hide the sidebar in case of the settings page. + if (this.tabs[this.activeTabIndex]?.properties?.page === "Settings") { + show = true; + } + this.$sidebar.classList.toggle("sidebar-hide", !show); }