story-research-zapwall/components/ConnectedUserMenu.tsx
Nicolas Cantu 3000872dbc refactoring
- **Motivations :** Assurer passage du lint strict et clarifier la logique paiements/publications.

- **Root causes :** Fonctions trop longues, promesses non gérées et typages WebLN/Nostr incomplets.

- **Correctifs :** Refactor PaymentModal (handlers void), extraction helpers articlePublisher, simplification polling sponsoring/zap, corrections curly et awaits.

- **Evolutions :** Nouveau module articlePublisherHelpers pour présentation/aiguillage contenu privé.

- **Page affectées :** components/PaymentModal.tsx, lib/articlePublisher.ts, lib/articlePublisherHelpers.ts, lib/paymentPolling.ts, lib/sponsoring.ts, lib/nostrZapVerification.ts et dépendances liées.
2025-12-22 17:56:00 +01:00

49 lines
1.3 KiB
TypeScript

import Image from 'next/image'
import Link from 'next/link'
import type { NostrProfile } from '@/types/nostr'
import { NotificationCenter } from './NotificationCenter'
interface ConnectedUserMenuProps {
pubkey: string
profile: NostrProfile | null
onDisconnect: () => void
loading: boolean
}
export function ConnectedUserMenu({
pubkey,
profile,
onDisconnect,
loading,
}: ConnectedUserMenuProps) {
const displayName = profile?.name ?? `${pubkey.slice(0, 8)}...`
return (
<div className="flex items-center gap-4">
<NotificationCenter userPubkey={pubkey} />
<Link
href="/profile"
className="flex items-center gap-2 hover:opacity-80 transition-opacity"
>
{profile?.picture && (
<Image
src={profile.picture}
alt={displayName}
width={32}
height={32}
className="rounded-full object-cover"
/>
)}
<span className="text-sm font-medium">{displayName}</span>
</Link>
<button
onClick={onDisconnect}
disabled={loading}
className="px-4 py-2 bg-gray-200 hover:bg-gray-300 rounded-lg text-sm font-medium transition-colors disabled:opacity-50"
>
Disconnect
</button>
</div>
)
}