disable sidebar while loading channels
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
Some checks failed
Build and Push Docker Image / build (push) Has been cancelled
and add new modal code for "non-operational" warning
This commit is contained in:
parent
3d4d5733b2
commit
eceee915fa
@ -161,9 +161,9 @@
|
|||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar .sidebar-content .sidebar-item:hover,
|
.sidebar .sidebar-content .sidebar-item:not(:disabled):hover,
|
||||||
.sidebar .sidebar-content .sidebar-item:focus,
|
.sidebar .sidebar-content .sidebar-item:not(:disabled):focus,
|
||||||
.sidebar .sidebar-content .sidebar-item.active {
|
.sidebar .sidebar-content .sidebar-item:not(:disabled).active {
|
||||||
background-color: var(--bs-body-bg);
|
background-color: var(--bs-body-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,9 +180,9 @@
|
|||||||
transition: 0.1s ease;
|
transition: 0.1s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar .sidebar-content .sidebar-item.is-not-operational:hover::before,
|
.sidebar .sidebar-content .sidebar-item.is-not-operational:not(:disabled):hover::before,
|
||||||
.sidebar .sidebar-content .sidebar-item.is-not-operational:focus::before,
|
.sidebar .sidebar-content .sidebar-item.is-not-operational:not(:disabled):focus::before,
|
||||||
.sidebar .sidebar-content .sidebar-item.is-not-operational.active::before {
|
.sidebar .sidebar-content .sidebar-item.is-not-operational:not(:disabled) .active::before {
|
||||||
transition: 0.3s ease;
|
transition: 0.3s ease;
|
||||||
width: 0.25rem;
|
width: 0.25rem;
|
||||||
height: 60px;
|
height: 60px;
|
||||||
|
@ -61,20 +61,35 @@ function loadedChannels(serverId) {
|
|||||||
$(document).on("selectedServerChange", async function() {
|
$(document).on("selectedServerChange", async function() {
|
||||||
serverId = selectedServer.id; // take note incase 'selectedServer' changes
|
serverId = selectedServer.id; // take note incase 'selectedServer' changes
|
||||||
|
|
||||||
|
$(".sidebar .sidebar-item").prop("disabled", true);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
channels = await ajaxRequest(`/generate-channels?guild=${serverId}`, "GET");
|
channels = await ajaxRequest(`/generate-channels?guild=${serverId}`, "GET");
|
||||||
_loadedChannels[serverId] = channels;
|
_loadedChannels[serverId] = channels;
|
||||||
|
$(".sidebar .sidebar-item").prop("disabled", false);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
logError(error);
|
logError(error);
|
||||||
|
|
||||||
|
// Mark the sidebar item as non-operational
|
||||||
$(`.sidebar .sidebar-item[data-id="${serverId}"]`).addClass("is-not-operational");
|
$(`.sidebar .sidebar-item[data-id="${serverId}"]`).addClass("is-not-operational");
|
||||||
await okModal(
|
|
||||||
"Error: Bot Isn't a Member!",
|
// Inform the user of the problem
|
||||||
"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.",
|
createModal({
|
||||||
"danger",
|
title: "Failed to Fetch Server Channels",
|
||||||
"bi-arrow-return-right",
|
texts: [
|
||||||
null
|
{ 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); }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user