import React, { useEffect, useRef, useState } from "react"; import { useModalStore } from "../../../stores/modalStore.js"; export function VoiceCallModal() { const { isOpen, type, data, onClose } = useModalStore(); const [isConnecting, setIsConnecting] = useState(true); const [participants, setParticipants] = useState([]); const videoRef = useRef(null); const isModalOpen = isOpen && type === "voiceCall"; useEffect(() => { if (isModalOpen) { // Simulate connection setTimeout(() => { setIsConnecting(false); setParticipants([ { id: 1, name: "You", isMuted: false, isVideoOff: false }, ]); }, 1500); } }, [isModalOpen]); if (!isModalOpen) return null; const handleEndCall = () => { setIsConnecting(true); setParticipants([]); onClose(); }; return (
{/* Header */}

{data?.roomName || "Voice Channel"}

{isConnecting ? "Connecting..." : `${participants.length} participant(s)`}

{/* Video Grid */}
{isConnecting ? (
🔊

Connecting to voice channel...

) : ( participants.map((participant) => (
{participant.name[0]}

{participant.name}

{participant.isMuted && 🔇 Muted} {participant.isVideoOff && 📹 Video Off} {!participant.isMuted && !participant.isVideoOff && 🎤 Speaking}
)) )}
{/* Controls */}
{/* LiveKit Debug Info */} {data?.token && (

LiveKit URL: {data.liveKitUrl}

Room: {data.roomName}

)}
); }