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 (
{isConnecting ? "Connecting..." : `${participants.length} participant(s)`}
Connecting to voice channel...
{participant.name}
LiveKit URL: {data.liveKitUrl}
Room: {data.roomName}