()
| 17 | import { useDraggable } from '../../app/hooks'; |
| 18 | |
| 19 | const CallPanel = () => { |
| 20 | const call = useCall(); |
| 21 | const { useCallCallingState, useCallCustomData } = useCallStateHooks(); |
| 22 | const callingState = useCallCallingState(); |
| 23 | const customData = useCallCustomData(); |
| 24 | const { channel: activeChannel } = useChatContext(); |
| 25 | const [panelElement, setPanelElement] = useState<HTMLDivElement | null>(null); |
| 26 | useDraggable(panelElement); |
| 27 | |
| 28 | if (!call) return null; |
| 29 | |
| 30 | const callingToActiveChannel = activeChannel?.cid === customData.channelCid; |
| 31 | // FIXME: currently does not show call panel when called from channel not loaded into state |
| 32 | if (CallingState.RINGING === callingState && !callingToActiveChannel) |
| 33 | return null; |
| 34 | |
| 35 | if (callingState === CallingState.JOINED) { |
| 36 | return ( |
| 37 | <div |
| 38 | className="str-video__call-panel rmc__call-panel-wrapper" |
| 39 | ref={setPanelElement} |
| 40 | > |
| 41 | <PaginatedGridLayout groupSize={4} /> |
| 42 | <div className="rmc__active-call-controls"> |
| 43 | <ScreenShareButton /> |
| 44 | <SpeakingWhileMutedNotification> |
| 45 | <ToggleAudioPublishingButton /> |
| 46 | </SpeakingWhileMutedNotification> |
| 47 | <ToggleVideoPublishingButton /> |
| 48 | <CancelCallButton /> |
| 49 | </div> |
| 50 | </div> |
| 51 | ); |
| 52 | } else if ( |
| 53 | [CallingState.RINGING, CallingState.JOINING].includes(callingState) |
| 54 | ) { |
| 55 | return ( |
| 56 | <div className="rmc__call-panel-wrapper" ref={setPanelElement}> |
| 57 | <RingingCall /> |
| 58 | </div> |
| 59 | ); |
| 60 | } |
| 61 | |
| 62 | return null; |
| 63 | }; |
| 64 | |
| 65 | export const Video = () => { |
| 66 | const calls = useCalls(); |
nothing calls this directly
no test coverage detected