import { Button } from "~/components/ui/button"; import { Card } from "~/components/ui/card"; interface ConnectionOverlayProps { isConnected: boolean; isReconnecting: boolean; connectionError: string | null; isSyncing: boolean; } export function ConnectionOverlay({ isConnected, isReconnecting, connectionError, isSyncing, }: ConnectionOverlayProps) { if (isConnected && !isSyncing) { return null; } return (
{/* Spinner or Error Icon */} {connectionError ? (
) : (
)} {/* Title */}

{connectionError ? "Connection Error" : isSyncing ? "Syncing Draft State..." : isReconnecting ? "Reconnecting..." : "Connecting to Draft"}

{connectionError ? ( connectionError ) : isSyncing ? ( "Reconnected. Syncing the latest draft state..." ) : isReconnecting ? ( "Lost connection to the draft server. Attempting to reconnect..." ) : ( "Please wait while we connect you to the live draft room." )}

{/* Action Button (only on persistent error) */} {connectionError && ( )} {/* Loading Dots */} {!connectionError && (
)}
); }