import { useUserStatus, SKATING_STATUSES } from '@/hooks/useUserStatus'; import { Badge } from '@/components/ui/badge'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import { cn } from '@/lib/utils'; interface UserStatusIndicatorProps { pubkey: string; className?: string; showLabel?: boolean; size?: 'sm' | 'md' | 'lg'; } export function UserStatusIndicator({ pubkey, className, showLabel = false, size = 'sm', }: UserStatusIndicatorProps) { const { data: status, isLoading } = useUserStatus(pubkey); if (isLoading || !status) return null; const preset = status.statusId ? SKATING_STATUSES.find(s => s.id === status.statusId) : null; const emoji = status.emoji || preset?.emoji || '🛹'; const label = preset?.label || status.status; const sizeClasses = { sm: 'text-xs px-1.5 py-0', md: 'text-sm px-2 py-0.5', lg: 'text-base px-3 py-1', }; const dotSizeClasses = { sm: 'w-2 h-2', md: 'w-2.5 h-2.5', lg: 'w-3 h-3', }; return (
{/* Pulsing dot indicator */} {showLabel && ( {emoji} {label} )}
{emoji}

{label}

{status.linkedSpot && (

📍 At a spot

)} {status.expiration && (

⏱️ Auto-clears in {Math.round((status.expiration - Date.now() / 1000) / 60)} min

)}
); }