Merge pull request #164 from PR0M3TH3AN/codex/update-moderation-list-loading-indication

Replace moderation relay warning with loading status
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2025-09-30 00:01:10 -04:00
commit 213f92f496
3 files changed
+80 -5

No files matched your search

+26
View File
@@ -834,6 +834,32 @@ button:not(.icon-button):focus {
display: flex;
}
.status-banner {
align-items: center;
background-color: rgba(31, 41, 55, 0.9);
border-radius: 0.5rem;
color: #e5e7eb;
display: flex;
gap: 0.75rem;
margin-bottom: 1rem;
padding: 1rem;
}
.status-banner .status-spinner {
animation: spin 1s linear infinite;
border: 0.125rem solid rgba(229, 231, 235, 0.35);
border-radius: 9999px;
border-top-color: #f9fafb;
height: 1.25rem;
width: 1.25rem;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* Responsive Design */
@media (max-width: 640px) {
#videoList {
+11
View File
@@ -155,6 +155,17 @@
class="hidden bg-red-100 text-red-900 p-4 rounded-md mb-4"
></div>
<!-- Status Container -->
<div
id="statusContainer"
class="hidden status-banner"
role="status"
aria-live="polite"
>
<span class="status-spinner" aria-hidden="true"></span>
<span class="status-message" data-status-message></span>
</div>
<!-- Success Container -->
<div
id="successContainer"
+43 -5
View File
@@ -663,6 +663,9 @@ class bitvidApp {
// Notification containers
this.errorContainer = document.getElementById("errorContainer") || null;
this.successContainer = document.getElementById("successContainer") || null;
this.statusContainer = document.getElementById("statusContainer") || null;
this.statusMessage =
this.statusContainer?.querySelector("[data-status-message]") || null;
// Auth state
this.pubkey = null;
@@ -1203,6 +1206,15 @@ class bitvidApp {
console.warn("Failed to refresh admin lists after connecting to Nostr:", error);
}
try {
await this.refreshAdminPaneState();
} catch (error) {
console.warn(
"Failed to update admin pane after connecting to Nostr:",
error
);
}
// Grab the "Subscriptions" link by its id in the sidebar
this.subscriptionsLink = document.getElementById("subscriptionsLink");
@@ -4742,6 +4754,7 @@ class bitvidApp {
let loadError = null;
this.setAdminLoading(true);
this.showStatus("Fetching moderation filters…");
try {
await accessControl.ensureReady();
} catch (error) {
@@ -4765,12 +4778,14 @@ class bitvidApp {
}
if (loadError) {
if (loadError?.code === "nostr-unavailable") {
console.info("Moderation lists are still syncing with relays.");
return;
}
console.error("Failed to load admin lists:", loadError);
const message =
loadError?.code === "nostr-unavailable"
? "Unable to reach Nostr relays. Moderation lists may be out of date."
: "Unable to load moderation lists. Please try again.";
this.showError(message);
this.showStatus(null);
this.showError("Unable to load moderation lists. Please try again.");
this.clearAdminLists();
this.setAdminLoading(false);
return;
@@ -4784,6 +4799,7 @@ class bitvidApp {
if (adminNav instanceof HTMLElement && adminNav.classList.contains("bg-gray-800")) {
this.selectProfilePane("account");
}
this.showStatus(null);
this.setAdminLoading(false);
return;
}
@@ -4793,6 +4809,7 @@ class bitvidApp {
this.adminModeratorsSection.setAttribute("aria-hidden", (!isSuperAdmin).toString());
}
this.populateAdminLists();
this.showStatus(null);
this.setAdminLoading(false);
}
@@ -9773,6 +9790,27 @@ class bitvidApp {
}, 5000);
}
showStatus(msg) {
if (!(this.statusContainer instanceof HTMLElement)) {
return;
}
if (!msg) {
if (this.statusMessage instanceof HTMLElement) {
this.statusMessage.textContent = "";
}
this.statusContainer.classList.add("hidden");
return;
}
if (this.statusMessage instanceof HTMLElement) {
this.statusMessage.textContent = msg;
} else {
this.statusContainer.textContent = msg;
}
this.statusContainer.classList.remove("hidden");
}
showSuccess(msg) {
if (!msg) {
this.successContainer.textContent = "";