From 15ce3c1dbb445c23c5c8f4476a0e7510b7bebc51 Mon Sep 17 00:00:00 2001 From: Corban-Lee Jones Date: Thu, 10 Oct 2024 22:24:58 +0100 Subject: [PATCH] prevent selecting the active server instead, hide the sidebar on smaller screens, so that the user's input doesn't feel unresponsive. --- apps/home/static/home/js/servers.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/home/static/home/js/servers.js b/apps/home/static/home/js/servers.js index efe2c3f..041cb9a 100644 --- a/apps/home/static/home/js/servers.js +++ b/apps/home/static/home/js/servers.js @@ -90,7 +90,10 @@ function createSelectButton(serverData) { // Bind the button for selecting this server template.find(".sidebar-item").off("click").on("click", function() { - selectServer($(this).data("id")); + const myID = $(this).data("id"); + + // only select if not already selected, otherwise hide sidebar on smaller screens (responsive) + selectedServer?.id !== myID ? selectServer(myID) : setSidebarVisibility(false); }); $("#serverList").prepend(template);