import React, { useEffect, useState } from 'react' import { RelayPool } from 'applesauce-relay' import { IEventStore } from 'applesauce-core' import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faBolt, faSpinner, faUserCircle } from '@fortawesome/free-solid-svg-icons' import { fetchBorisZappers, ZapSender } from '../services/zapReceiptService' import { fetchProfiles } from '../services/profileService' import { UserSettings } from '../services/settingsService' import { Models } from 'applesauce-core' import { useEventModel } from 'applesauce-react/hooks' import { useNavigate } from 'react-router-dom' import { nip19 } from 'nostr-tools' interface SupportProps { relayPool: RelayPool eventStore: IEventStore settings: UserSettings } type SupporterProfile = ZapSender const Support: React.FC = ({ relayPool, eventStore, settings }) => { const [supporters, setSupporters] = useState([]) const [loading, setLoading] = useState(true) useEffect(() => { const loadSupporters = async () => { setLoading(true) try { const zappers = await fetchBorisZappers(relayPool) if (zappers.length > 0) { const pubkeys = zappers.map(z => z.pubkey) await fetchProfiles(relayPool, eventStore, pubkeys, settings) } setSupporters(zappers) } catch (error) { console.error('Failed to load supporters:', error) } finally { setLoading(false) } } loadSupporters() }, [relayPool, eventStore, settings]) if (loading) { return (
) } return (
Thank you

Thank You!

Your{' '} zaps {' '}help keep this project alive.

{supporters.length === 0 ? (

No supporters yet. Be the first to zap Boris!

) : ( <> {/* Whales Section */} {supporters.filter(s => s.isWhale).length > 0 && (

Legends

{supporters.filter(s => s.isWhale).map(supporter => ( ))}
)} {/* Regular Supporters Section */} {supporters.filter(s => !s.isWhale).length > 0 && (

Supporters

{supporters.filter(s => !s.isWhale).map(supporter => ( ))}
)} )}

Zap{' '} Boris {' '}a{' '} meaningful amount of sats {' '}and your avatar will show above.

Total supporters: {supporters.length} • Total zaps: {supporters.reduce((sum, s) => sum + s.zapCount, 0)}

) } interface SupporterCardProps { supporter: SupporterProfile isWhale: boolean } const SupporterCard: React.FC = ({ supporter, isWhale }) => { const navigate = useNavigate() const profile = useEventModel(Models.ProfileModel, [supporter.pubkey]) const picture = profile?.picture const name = profile?.name || profile?.display_name || `${supporter.pubkey.slice(0, 8)}...` const handleClick = () => { const npub = nip19.npubEncode(supporter.pubkey) navigate(`/p/${npub}`) } return (
{/* Avatar */}
{picture ? ( {name} ) : ( )}
{/* Whale Badge */} {isWhale && (
)}
{/* Name and Total */}

{name}

{supporter.totalSats.toLocaleString()} sats

) } export default Support