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 && (
          <img src={profile.picture} alt={displayName} className="w-8 h-8 rounded-full" />
        )}
        <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>
  )
}

