'use client';

interface LiveIndicatorProps {
  isConnected: boolean;
  error?: string | null;
}

export function LiveIndicator({ isConnected, error }: LiveIndicatorProps) {
  if (error) {
    return (
      <div className="flex items-center gap-2 rounded-full bg-destructive/10 px-3 py-1.5 text-sm text-destructive">
        <span className="h-2 w-2 rounded-full bg-destructive" />
        <span>Hors ligne</span>
      </div>
    );
  }

  return (
    <div
      className={`flex items-center gap-2 rounded-full px-3 py-1.5 text-sm transition-colors ${
        isConnected
          ? 'bg-success/10 text-success'
          : 'bg-yellow/10 text-yellow'
      }`}
    >
      <span
        className={`h-2 w-2 rounded-full ${
          isConnected ? 'bg-success animate-pulse' : 'bg-yellow'
        }`}
      />
      <span>{isConnected ? 'Live' : 'Connexion...'}</span>
    </div>
  );
}


