diff --git a/apps/home/static/home/css/sidebar.css b/apps/home/static/home/css/sidebar.css index 72a74eb..909bc11 100644 --- a/apps/home/static/home/css/sidebar.css +++ b/apps/home/static/home/css/sidebar.css @@ -161,9 +161,9 @@ background-color: inherit; } -.sidebar .sidebar-content .sidebar-item:hover, -.sidebar .sidebar-content .sidebar-item:focus, -.sidebar .sidebar-content .sidebar-item.active { +.sidebar .sidebar-content .sidebar-item:not(:disabled):hover, +.sidebar .sidebar-content .sidebar-item:not(:disabled):focus, +.sidebar .sidebar-content .sidebar-item:not(:disabled).active { background-color: var(--bs-body-bg); } @@ -180,9 +180,9 @@ transition: 0.1s ease; } -.sidebar .sidebar-content .sidebar-item.is-not-operational:hover::before, -.sidebar .sidebar-content .sidebar-item.is-not-operational:focus::before, -.sidebar .sidebar-content .sidebar-item.is-not-operational.active::before { +.sidebar .sidebar-content .sidebar-item.is-not-operational:not(:disabled):hover::before, +.sidebar .sidebar-content .sidebar-item.is-not-operational:not(:disabled):focus::before, +.sidebar .sidebar-content .sidebar-item.is-not-operational:not(:disabled) .active::before { transition: 0.3s ease; width: 0.25rem; height: 60px; diff --git a/apps/home/static/home/js/servers.js b/apps/home/static/home/js/servers.js index 7c5c40d..1a4e556 100644 --- a/apps/home/static/home/js/servers.js +++ b/apps/home/static/home/js/servers.js @@ -61,20 +61,35 @@ function loadedChannels(serverId) { $(document).on("selectedServerChange", async function() { serverId = selectedServer.id; // take note incase 'selectedServer' changes + $(".sidebar .sidebar-item").prop("disabled", true); + try { channels = await ajaxRequest(`/generate-channels?guild=${serverId}`, "GET"); _loadedChannels[serverId] = channels; + $(".sidebar .sidebar-item").prop("disabled", false); } catch (error) { logError(error); + + // Mark the sidebar item as non-operational $(`.sidebar .sidebar-item[data-id="${serverId}"]`).addClass("is-not-operational"); - await okModal( - "Error: Bot Isn't a Member!", - "The PYRSS Discord Bot is unable to access this server, certain features won't work! Ensure it's a member and has the necessary permissions.", - "danger", - "bi-arrow-return-right", - null - ); + + // Inform the user of the problem + createModal({ + title: "Failed to Fetch Server Channels", + texts: [ + { content: "The Discord Bot is unable to access this server's channels, certain features will not work." }, + { content: "Ensure the Bot is a member, and has the neccessary permissions to operate." } + ], + buttons: [ + { + className: "btn-danger px-4", + iconClass: "bi-arrow-return-right", + closeModal: true, + onClick: () => { $(".sidebar .sidebar-item").prop("disabled", false); } + } + ] + }); } });