diff --git a/package.json b/package.json index ba99631..fb353cd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skate-spots", "private": true, - "version": "1.2.20", + "version": "1.2.21", "type": "module", "homepage": "https://skate-spots.com", "scripts": { diff --git a/src/components/ZapDialog.tsx b/src/components/ZapDialog.tsx index b0198e3..6dbbc3d 100644 --- a/src/components/ZapDialog.tsx +++ b/src/components/ZapDialog.tsx @@ -32,7 +32,6 @@ import { useZaps } from '@/hooks/useZaps'; import { useWallet } from '@/hooks/useWallet'; import { useIsMobile } from '@/hooks/useIsMobile'; import { useCashu } from '@/hooks/wallet/useCashu'; -import { useLightningOperations } from '@/hooks/wallet/useLightningOperations'; import { WalletModal } from '@/components/WalletModal'; import type { Event } from 'nostr-tools'; // qrcode imported lazily in async function to avoid canvas crash at module load @@ -363,27 +362,40 @@ const ZapContent = forwardRef(({ />
- {/* Show insufficient balance warning for Cashu */} - {paymentMethod === 'cashu' && cashuBalance !== undefined && ( - typeof amount === 'number' && amount > cashuBalance ? ( + {/* Show insufficient balance warning for Cashu. Coerce amount to a + number first — the custom-amount input stores it as a string, so a + plain `typeof === 'number'` check would let an over-balance custom + amount slip past both this warning and the disabled state. */} + {(() => { + const numericAmount = + typeof amount === 'string' ? parseInt(amount, 10) : amount; + const overBalance = + paymentMethod === 'cashu' && + cashuBalance !== undefined && + Number.isFinite(numericAmount) && + numericAmount > cashuBalance; + return overBalance ? (

- ⚠️ Insufficient Cashu balance. You need {(amount - cashuBalance).toLocaleString()} more sats. + ⚠️ Insufficient Cashu balance. You need {(numericAmount - cashuBalance).toLocaleString()} more sats. Switch to Lightning or top up your Cashu wallet.

- ) : null - )} - + ) : null; + })()} +