diff --git a/client/src/components/AudioOutput.jsx b/client/src/components/AudioOutput.jsx index ec77cec..6180d4d 100644 --- a/client/src/components/AudioOutput.jsx +++ b/client/src/components/AudioOutput.jsx @@ -1,10 +1,14 @@ import React, { useEffect, useRef } from "react"; -function AudioOutput({ currentAudioMessage, onFinishedPlaying }) { +function AudioOutput({ currentAudioMessage, onFinishedPlaying, stopAudio }) { const audioRef = useRef(null); const urlRef = useRef(null); const checkPlaybackIntervalRef = useRef(null); + useEffect(() => { + audioRef.current && audioRef.current.pause(); + }, [stopAudio]); + useEffect(() => { // Initialize the audio element if it does not exist if (!audioRef.current) { diff --git a/client/src/components/ConversationControls.jsx b/client/src/components/ConversationControls.jsx index 1d157d3..3b73c00 100644 --- a/client/src/components/ConversationControls.jsx +++ b/client/src/components/ConversationControls.jsx @@ -6,11 +6,14 @@ function ConversationControls({ onSkipForward, onRaiseHandOrNevermind, isRaisedHand, + humanInterjection, }) { return (
- - + {/* */} + {!humanInterjection && ( + + )} diff --git a/client/src/components/Council.jsx b/client/src/components/Council.jsx index 980dbbf..8b0fb1f 100644 --- a/client/src/components/Council.jsx +++ b/client/src/components/Council.jsx @@ -18,6 +18,8 @@ function Council({ options }) { const [audioMessages, setAudioMessages] = useState([]); // To store multiple ArrayBuffers const [isReady, setIsReady] = useState(false); const [isRaisedHand, setIsRaisedHand] = useState(false); + const [humanInterjection, setHumanInterjection] = useState(false); + const [skipForward, setSkipForward] = useState(false); const socketRef = useRef(null); // Using useRef to persist socket instance @@ -71,11 +73,18 @@ function Council({ options }) { setIsReady(true); } + function handleOnSkipForward() { + setSkipForward(!skipForward); + } + function handleOnRaiseHandOrNevermind() { - console.log("Setting isRaisedHand..."); setIsRaisedHand((prev) => !prev); } + function handleOnHumanInterjection(value) { + setHumanInterjection(value); + } + function displayResetWarning() { setActiveOverlay("reset"); } @@ -96,17 +105,23 @@ function Council({ options }) { className="text-container" style={{ justifyContent: "end" }} > + {humanInterjection && } {isReady && ( )}
diff --git a/client/src/components/HumanInput.jsx b/client/src/components/HumanInput.jsx index 4763592..cb4012c 100644 --- a/client/src/components/HumanInput.jsx +++ b/client/src/components/HumanInput.jsx @@ -2,11 +2,10 @@ import React from "react"; function HumanInput() { return ( -
+