import React, { useState } from "react"; import { useDaily, useParticipantIds, useAppMessage, DailyAudio, } from "@daily-co/daily-react"; import { IconLogout, IconLoader2 } from "@tabler/icons-react"; import VideoTile from "@/components/VideoTile"; import { Button } from "@/components/ui/button"; import UserInputIndicator from "@/components/UserInputIndicator"; import WaveText from "@/components/WaveText"; interface StoryProps { handleLeave: () => void; } const Story: React.FC = ({ handleLeave }) => { const daily = useDaily(); const participantIds = useParticipantIds({ filter: "remote" }); const [storyState, setStoryState] = useState<"user" | "assistant">( "assistant" ); useAppMessage({ onAppMessage: (e) => { if (!daily || !e.data?.cue) return; // Determine the UI state from the cue sent by the bot if (e.data?.cue === "user_turn") { // Delay enabling local mic input to avoid feedback from LLM setTimeout(() => daily.setLocalAudio(true), 500); setStoryState("user"); } else { daily.setLocalAudio(false); setStoryState("assistant"); } }, }); return (
{/* Absolute elements */}
{/* Static elements */}
{participantIds.length >= 1 ? ( ) : ( )}
); }; export default Story;