diff --git a/src/components/VapiWidget.tsx b/src/components/VapiWidget.tsx index a2941fb..78fa194 100644 --- a/src/components/VapiWidget.tsx +++ b/src/components/VapiWidget.tsx @@ -386,7 +386,9 @@ const VapiWidget: React.FC = ({ isCallActive={vapi.voice.isCallActive} connectionStatus={vapi.voice.connectionStatus} isAvailable={vapi.voice.isAvailable} + isMuted={vapi.voice.isMuted} onToggleCall={handleToggleCall} + onToggleMute={vapi.voice.toggleMute} startButtonText={effectiveStartButtonText} endButtonText={effectiveEndButtonText} colors={colors} @@ -417,9 +419,11 @@ const VapiWidget: React.FC = ({ connectionStatus={vapi.voice.connectionStatus} isChatAvailable={vapi.chat.isAvailable} isVoiceAvailable={vapi.voice.isAvailable} + isMuted={vapi.voice.isMuted} onInputChange={handleChatInputChange} onSendMessage={handleSendMessage} onToggleCall={handleToggleCall} + onToggleMute={vapi.voice.toggleMute} colors={colors} styles={styles} inputRef={inputRef} diff --git a/src/components/types.ts b/src/components/types.ts index a111f3d..7b38806 100644 --- a/src/components/types.ts +++ b/src/components/types.ts @@ -185,7 +185,9 @@ export interface VoiceControlsProps { isCallActive: boolean; connectionStatus: 'disconnected' | 'connecting' | 'connected'; isAvailable: boolean; + isMuted: boolean; onToggleCall: () => void; + onToggleMute: () => void; startButtonText: string; endButtonText: string; colors: ColorScheme; @@ -208,9 +210,11 @@ export interface HybridControlsProps { connectionStatus: 'disconnected' | 'connecting' | 'connected'; isChatAvailable: boolean; isVoiceAvailable: boolean; + isMuted: boolean; onInputChange: (e: React.ChangeEvent) => void; onSendMessage: () => void; onToggleCall: () => void; + onToggleMute: () => void; colors: ColorScheme; styles: StyleConfig; inputRef?: React.RefObject; diff --git a/src/components/widget/controls/HybridControls.tsx b/src/components/widget/controls/HybridControls.tsx index c996781..3bd0ba5 100644 --- a/src/components/widget/controls/HybridControls.tsx +++ b/src/components/widget/controls/HybridControls.tsx @@ -2,7 +2,9 @@ import React from 'react'; import { PaperPlaneTiltIcon, MicrophoneIcon, + MicrophoneSlashIcon, StopIcon, + WaveformIcon, } from '@phosphor-icons/react'; import { HybridControlsProps } from '../../types'; @@ -12,9 +14,11 @@ const HybridControls: React.FC = ({ connectionStatus, isChatAvailable, isVoiceAvailable, + isMuted, onInputChange, onSendMessage, onToggleCall, + onToggleMute, colors, styles, inputRef, @@ -66,6 +70,23 @@ const HybridControls: React.FC = ({ > + {isCallActive && connectionStatus === 'connected' && ( + + )} diff --git a/src/components/widget/controls/VoiceControls.tsx b/src/components/widget/controls/VoiceControls.tsx index fd19bbc..a7d476e 100644 --- a/src/components/widget/controls/VoiceControls.tsx +++ b/src/components/widget/controls/VoiceControls.tsx @@ -1,17 +1,41 @@ import React from 'react'; -import { MicrophoneIcon, StopIcon } from '@phosphor-icons/react'; +import { + MicrophoneIcon, + StopIcon, + MicrophoneSlashIcon, + WaveformIcon, +} from '@phosphor-icons/react'; import { VoiceControlsProps } from '../../types'; const VoiceControls: React.FC = ({ isCallActive, connectionStatus, isAvailable, + isMuted, onToggleCall, + onToggleMute, startButtonText, endButtonText, colors, }) => ( -
+
+ {isCallActive && connectionStatus === 'connected' && ( + + )}