mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
Merge pull request #959 from PR0M3TH3AN/codex/fix-sidebar-subscriptions-button-display
Ensure subscriptions link hydrates after sidebar load
This commit is contained in:
2 files changed
+34
-4
No files matched your search
@@ -5373,8 +5373,9 @@ class Application {
|
||||
this.profileButton.removeAttribute("hidden");
|
||||
}
|
||||
|
||||
if (this.subscriptionsLink) {
|
||||
this.subscriptionsLink.classList.remove("hidden");
|
||||
const subscriptionsLink = this.resolveSubscriptionsLink();
|
||||
if (subscriptionsLink) {
|
||||
subscriptionsLink.classList.remove("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5406,8 +5407,9 @@ class Application {
|
||||
this.profileButton.setAttribute("hidden", "");
|
||||
}
|
||||
|
||||
if (this.subscriptionsLink) {
|
||||
this.subscriptionsLink.classList.add("hidden");
|
||||
const subscriptionsLink = this.resolveSubscriptionsLink();
|
||||
if (subscriptionsLink) {
|
||||
subscriptionsLink.classList.add("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5419,6 +5421,26 @@ class Application {
|
||||
}
|
||||
}
|
||||
|
||||
resolveSubscriptionsLink() {
|
||||
if (this.subscriptionsLink instanceof HTMLElement) {
|
||||
return this.subscriptionsLink;
|
||||
}
|
||||
|
||||
const linkCandidate = document.getElementById("subscriptionsLink");
|
||||
if (linkCandidate instanceof HTMLElement) {
|
||||
this.subscriptionsLink = linkCandidate;
|
||||
return this.subscriptionsLink;
|
||||
}
|
||||
|
||||
this.subscriptionsLink = null;
|
||||
return null;
|
||||
}
|
||||
|
||||
hydrateSidebarNavigation() {
|
||||
this.resolveSubscriptionsLink();
|
||||
this.syncAuthUiState();
|
||||
}
|
||||
|
||||
maybeShowExperimentalLoginWarning(provider) {
|
||||
const normalizedProvider =
|
||||
typeof provider === "string" ? provider.trim().toLowerCase() : "";
|
||||
|
||||
@@ -620,6 +620,14 @@ async function bootstrapInterface() {
|
||||
await loadSidebar("components/sidebar.html", "sidebarContainer");
|
||||
devLogger.log("Sidebar loaded.");
|
||||
|
||||
if (application && typeof application.hydrateSidebarNavigation === "function") {
|
||||
try {
|
||||
application.hydrateSidebarNavigation();
|
||||
} catch (error) {
|
||||
devLogger.warn("[Interface] Failed to hydrate sidebar navigation:", error);
|
||||
}
|
||||
}
|
||||
|
||||
bindOptionalExternalLink({
|
||||
selector: "[data-blog-link]",
|
||||
url: BLOG_URL,
|
||||
|
||||
Reference in new issue
Block a user