From ca937418beeddc2608f7937cb48808bf16d57cb5 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:05:09 -0400 Subject: [PATCH 1/3] Show login notification when zap controls clicked while logged out --- js/channelProfile.js | 5 +---- js/ui/zapController.js | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/js/channelProfile.js b/js/channelProfile.js index 5f454cba..a1a10e9e 100644 --- a/js/channelProfile.js +++ b/js/channelProfile.js @@ -506,10 +506,7 @@ function setChannelZapVisibility(visible) { typeof app?.isUserLoggedIn === "function" ? app.isUserLoggedIn() : Boolean(app?.normalizeHexPubkey?.(app?.pubkey)); - const sessionActorPubkey = getSessionActorPubkey(); - const hasSessionActor = sessionActorPubkey.length > 0; - const sessionOnly = !isLoggedIn && hasSessionActor; - const shouldShow = !!visible && (isLoggedIn || sessionOnly); + const shouldShow = !!visible; const requiresLogin = shouldShow && !isLoggedIn; if ( diff --git a/js/ui/zapController.js b/js/ui/zapController.js index 53c99cde..4587cf90 100644 --- a/js/ui/zapController.js +++ b/js/ui/zapController.js @@ -97,9 +97,7 @@ export default class ZapController { setVisibility(visible) { const lightningVisible = !!visible; const loggedIn = this.isUserLoggedIn(); - const sessionActorAvailable = this.hasSessionActor(); - const shouldShow = - lightningVisible && (loggedIn || sessionActorAvailable); + const shouldShow = lightningVisible; const requiresLogin = shouldShow && !loggedIn; const hasWallet = this.hasActiveWalletConnection(); if (this.videoModal) { From 0a876314c199ff2e1dfb0ffcaec756cd1d0e0856 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:09:36 -0400 Subject: [PATCH 2/3] Adjust login-required zap notification behavior --- js/payments/zapNotifications.js | 34 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/js/payments/zapNotifications.js b/js/payments/zapNotifications.js index 0e10c3f8..b8217b8b 100644 --- a/js/payments/zapNotifications.js +++ b/js/payments/zapNotifications.js @@ -3,7 +3,7 @@ import { getApplication } from "../applicationContext.js"; import { LOGIN_TO_ZAP_MESSAGE } from "./zapMessages.js"; -const LOGIN_NOTIFICATION_AUTO_HIDE_MS = 5000; +const LOGIN_NOTIFICATION_AUTO_HIDE_MS = 3000; function getOwnerDocument(node) { return node?.ownerDocument || null; @@ -108,7 +108,12 @@ function ensureNotificationPortal({ doc, HTMLElementCtor }) { return portal instanceof HTMLElementCtor ? portal : null; } -function ensureStatusContainer({ doc, portal, HTMLElementCtor }) { +function ensureStatusContainer({ + doc, + portal, + HTMLElementCtor, + includeSpinner = true, +}) { if (!doc || !HTMLElementCtor) { return { container: null, messageTarget: null }; } @@ -123,10 +128,12 @@ function ensureStatusContainer({ doc, portal, HTMLElementCtor }) { statusContainer.setAttribute("role", "status"); statusContainer.setAttribute("aria-live", "polite"); - const spinner = doc.createElement("span"); - spinner.className = "status-spinner"; - spinner.setAttribute("aria-hidden", "true"); - statusContainer.appendChild(spinner); + if (includeSpinner) { + const spinner = doc.createElement("span"); + spinner.className = "status-spinner"; + spinner.setAttribute("aria-hidden", "true"); + statusContainer.appendChild(spinner); + } const message = doc.createElement("span"); message.className = "status-message"; @@ -134,11 +141,15 @@ function ensureStatusContainer({ doc, portal, HTMLElementCtor }) { statusContainer.appendChild(message); } else { const existingSpinner = statusContainer.querySelector(".status-spinner"); - if (!(existingSpinner instanceof HTMLElementCtor)) { - const spinner = doc.createElement("span"); - spinner.className = "status-spinner"; - spinner.setAttribute("aria-hidden", "true"); - statusContainer.insertBefore(spinner, statusContainer.firstChild); + if (includeSpinner) { + if (!(existingSpinner instanceof HTMLElementCtor)) { + const spinner = doc.createElement("span"); + spinner.className = "status-spinner"; + spinner.setAttribute("aria-hidden", "true"); + statusContainer.insertBefore(spinner, statusContainer.firstChild); + } + } else if (existingSpinner instanceof HTMLElementCtor) { + existingSpinner.remove(); } } @@ -299,6 +310,7 @@ export function showLoginRequiredToZapNotification({ doc, portal, HTMLElementCtor, + includeSpinner: false, }); if (statusContainer instanceof HTMLElementCtor) { From bfcef3c5d75910bc5f7886dad56f00045218a867 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 19 Oct 2025 14:27:18 -0400 Subject: [PATCH 3/3] Remove spinner from login-required zap notification --- js/app.js | 26 +++++++++++++++++++++++--- js/payments/zapNotifications.js | 6 +++--- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/js/app.js b/js/app.js index 7628279d..92564f74 100644 --- a/js/app.js +++ b/js/app.js @@ -7402,6 +7402,29 @@ class Application { return; } + const { autoHideMs, showSpinner } = + options && typeof options === "object" ? options : Object.create(null); + + const shouldShowSpinner = showSpinner !== false; + const existingSpinner = container.querySelector(".status-spinner"); + + if (shouldShowSpinner) { + if (!(existingSpinner instanceof HTMLElementCtor)) { + const spinner = ownerDocument?.createElement?.("span") || null; + if (spinner) { + spinner.className = "status-spinner"; + spinner.setAttribute("aria-hidden", "true"); + if (messageTarget && container.contains(messageTarget)) { + container.insertBefore(spinner, messageTarget); + } else { + container.insertBefore(spinner, container.firstChild); + } + } + } + } else if (existingSpinner instanceof HTMLElementCtor) { + existingSpinner.remove(); + } + if (!msg) { if (messageTarget && messageTarget instanceof HTMLElementCtor) { messageTarget.textContent = ""; @@ -7411,9 +7434,6 @@ class Application { return; } - const { autoHideMs } = - options && typeof options === "object" ? options : Object.create(null); - if (messageTarget && messageTarget instanceof HTMLElementCtor) { messageTarget.textContent = msg; } else { diff --git a/js/payments/zapNotifications.js b/js/payments/zapNotifications.js index b8217b8b..36cd0848 100644 --- a/js/payments/zapNotifications.js +++ b/js/payments/zapNotifications.js @@ -38,12 +38,12 @@ function isNotificationBannerActive({ return text === expectedText; } -function attemptStatusBanner(app, { autoHideMs, expectedText }) { +function attemptStatusBanner(app, { autoHideMs, expectedText, showSpinner }) { if (!app || typeof app.showStatus !== "function") { return false; } - app.showStatus(expectedText, { autoHideMs }); + app.showStatus(expectedText, { autoHideMs, showSpinner }); return isNotificationBannerActive({ container: app.statusContainer, @@ -286,7 +286,7 @@ export function showLoginRequiredToZapNotification({ getOwnerDocument(app?.statusContainer) || getOwnerDocument(app?.errorContainer); - if (attemptStatusBanner(app, { autoHideMs, expectedText })) { + if (attemptStatusBanner(app, { autoHideMs, expectedText, showSpinner: false })) { return true; }