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 { useTranslation } from "react-i18next"; 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) { const { t } = useTranslation(); return ( {show && ( {t('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) { const { t } = useTranslation(); return ( {show && ( {t('Connection_Issue_Detected')} {t('Verify_device_powered_and_connected')} {t('Check_cable_loose_damaged')} {t('Verify_device_powered_and_connected')} {t('Try_restarting_both_device_computer')} setupPeerConnection()} LeadingIcon={ArrowPathIcon} text={t('Try_again')} size="SM" theme="light" /> )} ); } interface PeerConnectionDisconnectedOverlay { readonly show: boolean; } export function PeerConnectionDisconnectedOverlay({ show, }: PeerConnectionDisconnectedOverlay) { const { t } = useTranslation(); return ( {show && ( {t('Connection_Issue_Detected')} {t('Verify_device_powered_and_connected')} {t('Check_cable_loose_damaged')} {t('Verify_device_powered_and_connected')} {t('Try_restarting_both_device_computer')} {t('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"; const { t } = useTranslation(); return ( <> {show && isNoSignal && ( {t('No_HDMI_signal_detected')} {t('Ensure_the_HDMI_cable_securely_connected_at_both_ends')} {t('Ensure_source_device_is_powered_on_and_outputting_a_signal')} {t('If_using_an_adapter')} )} {show && isOtherError && ( {t('HDMI_signal_error_detected')} {t('A_loose_or_faulty_HDMI_connection')} {t('Incompatible_resolution_or_refresh_rate_settings')} {t('Issues_with_the_source_devices_HDMI_output')} )} > ); } interface NoAutoplayPermissionsOverlayProps { readonly show: boolean; readonly onPlayClick: () => void; } export function NoAutoplayPermissionsOverlay({ show, onPlayClick, }: NoAutoplayPermissionsOverlayProps) { const { t } = useTranslation(); return ( {show && ( {t('Autoplay_permissions_required')} {t('Please_adjust_browser_settings_to_enable_autoplay')} )} ); } interface PointerLockBarProps { readonly show: boolean; } export function PointerLockBar({ show }: PointerLockBarProps) { const { t } = useTranslation(); return ( {show ? ( {t('Click_video_enable_mouse_control')} ) : null} ); }
{t('Loading_video_stream')}...
{text}
{t('Retrying_connection')}...