Improve channel view loading and fix card menu

This commit is contained in:
thePR0M3TH3AN committed 2025-10-08 12:39:51 -04:00
1 parent cb18615c1b
commit eaae8066da
2 files changed
+23 -4

No files matched your search

+22 -4
View File
@@ -1360,12 +1360,22 @@ export async function initChannelProfileView() {
setupChannelShareButton();
setupChannelMoreMenu();
await updateChannelMenuState();
const initialMenuRefresh = updateChannelMenuState().catch((error) => {
console.error("Failed to prepare channel menu state:", error);
});
let subscriptionsTask = null;
// 3) If user is logged in, load subscriptions and show sub/unsub button
if (app?.pubkey) {
await subscriptions.loadSubscriptions(app.pubkey);
renderSubscribeButton(hexPub);
subscriptionsTask = subscriptions
.loadSubscriptions(app.pubkey)
.catch((error) => {
console.error("Failed to load subscriptions for channel view:", error);
})
.finally(() => {
renderSubscribeButton(hexPub);
});
} else {
const btn = document.getElementById("subscribeBtnArea");
if (btn) btn.classList.add("hidden");
@@ -1388,7 +1398,15 @@ export async function initChannelProfileView() {
console.error("Failed to load channel videos:", error);
});
await Promise.allSettled([profilePromise, videosPromise]);
const pendingTasks = [profilePromise, videosPromise];
if (initialMenuRefresh) {
pendingTasks.push(initialMenuRefresh);
}
if (subscriptionsTask) {
pendingTasks.push(subscriptionsTask);
}
await Promise.allSettled(pendingTasks);
}
function setupZapButton() {
+1
View File
@@ -639,6 +639,7 @@ export class VideoCard {
},
});
button.dataset.moreDropdown = String(this.index);
button.dataset.moreMenuToggleBound = "true";
const icon = this.document.createElement("img");
icon.src = "assets/svg/ellipsis.svg";