-
-
-
- {showLoading ? (
- '...'
- ) : showCount && totalSats > 0 ? (
- `${totalSats.toLocaleString()}`
- ) : (
- 'Zap'
- )}
-
-
-
- );
-}
\ No newline at end of file
diff --git a/src/hooks/useZaps.ts b/src/hooks/useZaps.ts
index ec16d450..c9a309fb 100644
--- a/src/hooks/useZaps.ts
+++ b/src/hooks/useZaps.ts
@@ -1,4 +1,4 @@
-import { useState, useMemo, useEffect, useCallback } from 'react';
+import { useState, useEffect, useCallback } from 'react';
import { useCurrentUser } from '@/hooks/useCurrentUser';
import { useAuthor } from '@/hooks/useAuthor';
import { useAppContext } from '@/hooks/useAppContext';
@@ -8,26 +8,24 @@ import type { NWCConnection } from '@/hooks/useNWC';
import { nip57 } from 'nostr-tools';
import type { Event } from 'nostr-tools';
import type { WebLNProvider } from '@webbtc/webln-types';
-import { useQuery, useQueryClient } from '@tanstack/react-query';
-import { useNostr } from '@nostrify/react';
-import type { NostrEvent } from '@nostrify/nostrify';
+import { useQueryClient } from '@tanstack/react-query';
+/**
+ * Hook for sending zaps to an event author.
+ * Stats (zap count, total sats) come from NIP-85 via useEventStats — this hook
+ * only handles the payment flow.
+ */
export function useZaps(
- target: Event | Event[],
+ target: Event,
webln: WebLNProvider | null,
_nwcConnection: NWCConnection | null,
onZapSuccess?: () => void
) {
- const { nostr } = useNostr();
const { toast } = useToast();
const { user } = useCurrentUser();
const { config } = useAppContext();
const queryClient = useQueryClient();
-
- // Handle the case where an empty array is passed (from ZapButton when external data is provided)
- const actualTarget = Array.isArray(target) ? (target.length > 0 ? target[0] : null) : target;
-
- const author = useAuthor(actualTarget?.pubkey);
+ const author = useAuthor(target?.pubkey);
const { sendPayment, getActiveConnection } = useNWC();
const [isZapping, setIsZapping] = useState(false);
const [invoice, setInvoice] = useState