From b77885093c04d300d2a11fa1ef7ffd9ca67be1ec Mon Sep 17 00:00:00 2001 From: Chad Curtis Date: Sun, 5 Oct 2025 20:48:58 +0000 Subject: [PATCH] Remove webln from state, simplify webln detection. --- src/components/WalletModal.tsx | 16 ++++++++-------- src/components/ZapDialog.tsx | 10 +++++----- src/hooks/useShakespeare.ts | 32 ++++++++++++++++---------------- src/hooks/useWallet.ts | 12 +++--------- 4 files changed, 32 insertions(+), 38 deletions(-) diff --git a/src/components/WalletModal.tsx b/src/components/WalletModal.tsx index c8f26dc..ef77855 100644 --- a/src/components/WalletModal.tsx +++ b/src/components/WalletModal.tsx @@ -68,7 +68,7 @@ AddWalletContent.displayName = 'AddWalletContent'; // Extracted WalletContent to prevent re-renders const WalletContent = forwardRef; @@ -77,7 +77,7 @@ const WalletContent = forwardRef void; setAddDialogOpen: (open: boolean) => void; }>(({ - hasWebLN, + webln, hasNWC, connections, connectionInfo, @@ -101,9 +101,9 @@ const WalletContent = forwardRef
- {hasWebLN && } - - {hasWebLN ? "Ready" : "Not Found"} + {webln && } + + {webln ? "Ready" : "Not Found"}
@@ -189,7 +189,7 @@ const WalletContent = forwardRef {/* Help */} - {!hasWebLN && connections.length === 0 && ( + {!webln && connections.length === 0 && ( <>
@@ -220,7 +220,7 @@ export function WalletModal({ children, className }: WalletModalProps) { setActiveConnection } = useNWC(); - const { hasWebLN } = useWallet(); + const { webln } = useWallet(); const hasNWC = connections.length > 0 && connections.some(c => c.isConnected); const { toast } = useToast(); @@ -261,7 +261,7 @@ export function WalletModal({ children, className }: WalletModalProps) { }; const walletContentProps = { - hasWebLN, + webln, hasNWC, connections, connectionInfo, diff --git a/src/components/ZapDialog.tsx b/src/components/ZapDialog.tsx index a7b2481..934dfa6 100644 --- a/src/components/ZapDialog.tsx +++ b/src/components/ZapDialog.tsx @@ -55,7 +55,7 @@ interface ZapContentProps { isZapping: boolean; qrCodeUrl: string; copied: boolean; - hasWebLN: boolean; + webln: import('@webbtc/webln-types').WebLNProvider | null; handleZap: () => void; handleCopy: () => void; openInWallet: () => void; @@ -73,7 +73,7 @@ const ZapContent = forwardRef(({ isZapping, qrCodeUrl, copied, - hasWebLN, + webln, handleZap, handleCopy, openInWallet, @@ -138,7 +138,7 @@ const ZapContent = forwardRef(({ {/* Payment buttons */}
- {hasWebLN && ( + {webln && (