From 01ef4c61bd906230708fc63887f35d76b3fef72f Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 17 Jun 2025 08:45:11 -0700 Subject: [PATCH] Only open/close both sidebars at the same time on desktop --- js/main.js | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/js/main.js b/js/main.js index 8b31bbaa..f018e332 100644 --- a/js/main.js +++ b/js/main.js @@ -791,15 +791,18 @@ pastChatsToggle.addEventListener("click", () => { const isCurrentlyOpen = !pastChatsRow.classList.contains("sidebar-hidden"); toggleSidebar(pastChatsRow, pastChatsToggle); - if (isCurrentlyOpen) { - // If we just closed the left sidebar, also close the right sidebar - if (!chatControlsRow.classList.contains("sidebar-hidden")) { - toggleSidebar(chatControlsRow, chatControlsToggle, true); - } - } else { - // If we just opened the left sidebar, also open the right sidebar - if (chatControlsRow.classList.contains("sidebar-hidden")) { - toggleSidebar(chatControlsRow, chatControlsToggle, false); + // On desktop, open/close both sidebars at the same time + if (!isMobile()) { + if (isCurrentlyOpen) { + // If we just closed the left sidebar, also close the right sidebar + if (!chatControlsRow.classList.contains("sidebar-hidden")) { + toggleSidebar(chatControlsRow, chatControlsToggle, true); + } + } else { + // If we just opened the left sidebar, also open the right sidebar + if (chatControlsRow.classList.contains("sidebar-hidden")) { + toggleSidebar(chatControlsRow, chatControlsToggle, false); + } } } }); @@ -808,15 +811,18 @@ chatControlsToggle.addEventListener("click", () => { const isCurrentlyOpen = !chatControlsRow.classList.contains("sidebar-hidden"); toggleSidebar(chatControlsRow, chatControlsToggle); - if (isCurrentlyOpen) { - // If we just closed the right sidebar, also close the left sidebar - if (!pastChatsRow.classList.contains("sidebar-hidden")) { - toggleSidebar(pastChatsRow, pastChatsToggle, true); - } - } else { - // If we just opened the right sidebar, also open the left sidebar - if (pastChatsRow.classList.contains("sidebar-hidden")) { - toggleSidebar(pastChatsRow, pastChatsToggle, false); + // On desktop, open/close both sidebars at the same time + if (!isMobile()) { + if (isCurrentlyOpen) { + // If we just closed the right sidebar, also close the left sidebar + if (!pastChatsRow.classList.contains("sidebar-hidden")) { + toggleSidebar(pastChatsRow, pastChatsToggle, true); + } + } else { + // If we just opened the right sidebar, also open the left sidebar + if (pastChatsRow.classList.contains("sidebar-hidden")) { + toggleSidebar(pastChatsRow, pastChatsToggle, false); + } } } });