@@ -3,12 +3,14 @@ import ScreenShareOff from '../icons/ScreenShareOff';
33import ScreenShareIcon from '../icons/ScreenShareIcon' ;
44import mediaStyle from '@/styles/Components.module.css' ;
55import { ConnectionState , Track } from 'livekit-client' ;
6- import { useSetConnectionState , useSetCurrentRoomId , useSetCurrentRoomName , useSetCurrentRoomServerId , useSetToken , useConnectionRef } from '@/lib/store' ;
6+ import { useSetConnectionState , useSetCurrentRoomId , useSetCurrentRoomName , useSetCurrentRoomServerId , useSetToken , useConnectionRef , useSetUserSettings , useUserSettings } from '@/lib/store' ;
77import { Channel } from '@/types/dbtypes' ;
88import CameraOffIcon from '../icons/CameraOffIcon' ;
99import CameraIcon from '../icons/CameraIcon' ;
1010import JoinCallIcon from '../icons/JoinCallIcon' ;
1111import HangUpIcon from '../icons/HangUpIcon' ;
12+ import MicrophoneIcon from '../icons/MicrophoneIcon' ;
13+ import MicrophoneOff from '../icons/MicroPhoneOff' ;
1214
1315export function FloatingCallControl ( { visibleChannel, token } : { visibleChannel ?: Channel , token ?: string } ) {
1416 const connectionState = useConnectionState ( ) ;
@@ -18,6 +20,8 @@ export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?
1820 const setRoomServerId = useSetCurrentRoomServerId ( ) ;
1921 const setRoomIdRef = useSetCurrentRoomId ( ) ;
2022 const setRoomName = useSetCurrentRoomName ( ) ;
23+ const settingsRef = useSetUserSettings ( ) ;
24+ const userSettings = useUserSettings ( ) ;
2125
2226 const handleConnect = ( ) => {
2327 setConnectionState ( true ) ,
@@ -85,6 +89,39 @@ export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?
8589 ) }
8690 </ TrackToggle >
8791 ) }
92+ { connectionState !== ConnectionState . Connected ? (
93+ < div className = { `${ mediaStyle . appear } ` } >
94+ { ' ' }
95+ { userSettings ? (
96+ < button
97+ onClick = { ( ) => settingsRef ( false ) }
98+ className = { `w-7 h-7 rounded-lg p-1 bg-frost-600 flex items-center justify-center ${ mediaStyle . appear } ` }
99+ >
100+ < MicrophoneIcon width = { 5 } height = { 5 } />
101+ </ button >
102+ ) : (
103+ < button
104+ onClick = { ( ) => settingsRef ( true ) }
105+ className = { `w-7 h-7 rounded-lg p-1 bg-frost-600 flex items-center justify-center ${ mediaStyle . appear } ` }
106+ >
107+ < MicrophoneOff width = { 5 } height = { 5 } />
108+ </ button >
109+ ) }
110+ </ div >
111+ ) : (
112+ < TrackToggle
113+ showIcon = { false }
114+ source = { Track . Source . Microphone }
115+ onClick = { ( ) => settingsRef ( false ) }
116+ className = { `w-7 h-7 rounded-lg p-1 bg-frost-600 flex items-center justify-center ${ mediaStyle . appear } ` }
117+ >
118+ { currentParticipant . isMicrophoneEnabled ? (
119+ < MicrophoneIcon width = { 6 } height = { 6 } />
120+ ) : (
121+ < MicrophoneOff width = { 6 } height = { 6 } />
122+ ) }
123+ </ TrackToggle >
124+ ) }
88125 { connectionState !== ConnectionState . Connected ? (
89126 < button
90127 className = "w-7 h-7 bg-green-500 hover:bg-green-700 rounded-lg font-bold text-md flex items-center justify-center"
@@ -97,7 +134,7 @@ export function FloatingCallControl({ visibleChannel, token }: { visibleChannel?
97134 ) : (
98135 < DisconnectButton
99136 className = {
100- 'w-7 h-7 bg-red-500 hover:bg-red-700 rounded-lg font-bold text-xl flex items-center justify-center'
137+ 'w-7 h-7 bg-red-500 hover:bg-red-700 rounded-lg flex items-center justify-center'
101138 }
102139 onClick = { ( ) => {
103140 setConnectionState ( false ) ;
0 commit comments