import React from "react"; import { ExclamationTriangleIcon } from "@heroicons/react/24/solid"; import { ArrowPathIcon, ArrowRightIcon } from "@heroicons/react/16/solid"; import { motion, AnimatePresence } from "framer-motion"; import { LuPlay } from "react-icons/lu"; import { BsMouseFill } from "react-icons/bs"; import { Button, LinkButton } from "@components/Button"; import LoadingSpinner from "@components/LoadingSpinner"; import Card, { GridCard } from "@components/Card"; interface OverlayContentProps { readonly children: React.ReactNode; } function OverlayContent({ children }: OverlayContentProps) { return ( {children} ); } interface LoadingOverlayProps { readonly show: boolean; } export function LoadingVideoOverlay({ show }: LoadingOverlayProps) { return ( {show && ( Loading video stream... )} ); } interface LoadingConnectionOverlayProps { readonly show: boolean; readonly text: string; } export function LoadingConnectionOverlay({ show, text }: LoadingConnectionOverlayProps) { return ( {show && ( {text} )} ); } interface ConnectionErrorOverlayProps { readonly show: boolean; readonly setupPeerConnection: () => Promise; } export function ConnectionFailedOverlay({ show, setupPeerConnection, }: ConnectionErrorOverlayProps) { return ( {show && ( Connection Issue Detected Verify that the device is powered on and properly connected Check all cable connections for any loose or damaged wires Ensure your network connection is stable and active Try restarting both the device and your computer setupPeerConnection()} LeadingIcon={ArrowPathIcon} text="Try again" size="SM" theme="light" /> )} ); } interface PeerConnectionDisconnectedOverlay { readonly show: boolean; } export function PeerConnectionDisconnectedOverlay({ show, }: PeerConnectionDisconnectedOverlay) { return ( {show && ( Connection Issue Detected Verify that the device is powered on and properly connected Check all cable connections for any loose or damaged wires Ensure your network connection is stable and active Try restarting both the device and your computer Retrying connection... )} ); } interface HDMIErrorOverlayProps { readonly show: boolean; readonly hdmiState: string; } export function HDMIErrorOverlay({ show, hdmiState }: HDMIErrorOverlayProps) { const isNoSignal = hdmiState === "no_signal"; const isOtherError = hdmiState === "no_lock" || hdmiState === "out_of_range"; return ( <> {show && isNoSignal && ( No HDMI signal detected. Ensure the HDMI cable securely connected at both ends Ensure source device is powered on and outputting a signal If using an adapter, ensure it's compatible and functioning correctly )} {show && isOtherError && ( HDMI signal error detected. A loose or faulty HDMI connection Incompatible resolution or refresh rate settings Issues with the source device's HDMI output )} > ); } interface NoAutoplayPermissionsOverlayProps { readonly show: boolean; readonly onPlayClick: () => void; } export function NoAutoplayPermissionsOverlay({ show, onPlayClick, }: NoAutoplayPermissionsOverlayProps) { return ( {show && ( Autoplay permissions required Please adjust browser settings to enable autoplay )} ); } interface PointerLockBarProps { readonly show: boolean; } export function PointerLockBar({ show }: PointerLockBarProps) { return ( {show ? ( Click on the video to enable mouse control ) : null} ); }
Loading video stream...
{text}
Retrying connection...