-
Notifications
You must be signed in to change notification settings - Fork 67
/
BottomBar.js
888 lines (830 loc) · 30.2 KB
/
BottomBar.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
import {
Constants,
useMeeting,
usePubSub,
useMediaDevice,
} from "@videosdk.live/react-sdk";
import React, { Fragment, useEffect, useMemo, useRef, useState } from "react";
import {
ClipboardIcon,
CheckIcon,
ChevronDownIcon,
DotsHorizontalIcon,
} from "@heroicons/react/outline";
import recordingBlink from "../../static/animations/recording-blink.json";
import useIsRecording from "../../hooks/useIsRecording";
import RecordingIcon from "../../icons/Bottombar/RecordingIcon";
import MicOnIcon from "../../icons/Bottombar/MicOnIcon";
import MicOffIcon from "../../icons/Bottombar/MicOffIcon";
import WebcamOnIcon from "../../icons/Bottombar/WebcamOnIcon";
import WebcamOffIcon from "../../icons/Bottombar/WebcamOffIcon";
import ScreenShareIcon from "../../icons/Bottombar/ScreenShareIcon";
import ChatIcon from "../../icons/Bottombar/ChatIcon";
import ParticipantsIcon from "../../icons/Bottombar/ParticipantsIcon";
import EndIcon from "../../icons/Bottombar/EndIcon";
import RaiseHandIcon from "../../icons/Bottombar/RaiseHandIcon";
import PipIcon from "../../icons/Bottombar/PipIcon";
import { OutlinedButton } from "../../components/buttons/OutlinedButton";
import useIsTab from "../../hooks/useIsTab";
import useIsMobile from "../../hooks/useIsMobile";
import { MobileIconButton } from "../../components/buttons/MobileIconButton";
import { sideBarModes } from "../../utils/common";
import { Dialog, Popover, Transition } from "@headlessui/react";
import { createPopper } from "@popperjs/core";
import { useMeetingAppContext } from "../../MeetingAppContextDef";
import useMediaStream from "../../hooks/useMediaStream";
function PipBTN({ isMobile, isTab }) {
const { pipMode, setPipMode } = useMeetingAppContext();
const getRowCount = (length) => {
return length > 2 ? 2 : length > 0 ? 1 : 0;
};
const getColCount = (length) => {
return length < 2 ? 1 : length < 5 ? 2 : 3;
};
const pipWindowRef = useRef(null);
const togglePipMode = async () => {
//Check if PIP Window is active or not
//If active we will turn it off
if (pipWindowRef.current) {
await document.exitPictureInPicture();
pipWindowRef.current = null;
return;
}
//Check if browser supports PIP mode else show a message to user
if ("pictureInPictureEnabled" in document) {
//Creating a Canvas which will render our PIP Stream
const source = document.createElement("canvas");
const ctx = source.getContext("2d");
//Create a Video tag which we will popout for PIP
const pipVideo = document.createElement("video");
pipWindowRef.current = pipVideo;
pipVideo.autoplay = true;
//Creating stream from canvas which we will play
const stream = source.captureStream();
pipVideo.srcObject = stream;
drawCanvas();
//When Video is ready we will start PIP mode
pipVideo.onloadedmetadata = () => {
pipVideo.requestPictureInPicture();
};
await pipVideo.play();
//When the PIP mode starts, we will start drawing canvas with PIP view
pipVideo.addEventListener("enterpictureinpicture", (event) => {
drawCanvas();
setPipMode(true);
});
//When PIP mode exits, we will dispose the track we created earlier
pipVideo.addEventListener("leavepictureinpicture", (event) => {
pipWindowRef.current = null;
setPipMode(false);
pipVideo.srcObject.getTracks().forEach((track) => track.stop());
});
//These will draw all the video elements in to the Canvas
function drawCanvas() {
//Getting all the video elements in the document
const videos = document.querySelectorAll("video");
try {
//Perform initial black paint on the canvas
ctx.fillStyle = "black";
ctx.fillRect(0, 0, source.width, source.height);
//Drawing the participant videos on the canvas in the grid format
const rows = getRowCount(videos.length);
const columns = getColCount(videos.length);
for (let i = 0; i < rows; i++) {
for (let j = 0; j < columns; j++) {
if (j + i * columns <= videos.length || videos.length === 1) {
ctx.drawImage(
videos[j + i * columns],
j < 1 ? 0 : source.width / (columns / j),
i < 1 ? 0 : source.height / (rows / i),
source.width / columns,
source.height / rows
);
}
}
}
} catch (error) {
console.log(error);
}
//If pip mode is on, keep drawing the canvas when ever new frame is requested
if (document.pictureInPictureElement === pipVideo) {
requestAnimationFrame(drawCanvas);
}
}
} else {
alert("PIP is not supported by your browser");
}
};
return isMobile || isTab ? (
<MobileIconButton
id="pip-btn"
tooltipTitle={pipMode ? "Stop PiP" : "Start Pip"}
buttonText={pipMode ? "Stop PiP" : "Start Pip"}
isFocused={pipMode}
Icon={PipIcon}
onClick={() => {
togglePipMode();
}}
disabled={false}
/>
) : (
<OutlinedButton
Icon={PipIcon}
onClick={() => {
togglePipMode();
}}
isFocused={pipMode}
tooltip={pipMode ? "Stop PiP" : "Start Pip"}
disabled={false}
/>
);
}
const MicBTN = () => {
const {
selectedMic,
setSelectedMic,
selectedSpeaker,
setSelectedSpeaker,
isMicrophonePermissionAllowed,
} = useMeetingAppContext();
const { getMicrophones, getPlaybackDevices } = useMediaDevice();
const mMeeting = useMeeting();
const [mics, setMics] = useState([]);
const [speakers, setSpeakers] = useState([]);
const localMicOn = mMeeting?.localMicOn;
const changeMic = mMeeting?.changeMic;
useMediaDevice({
onDeviceChanged
})
function onDeviceChanged(devices){
getMics();
const newSpeakerList = devices.devices.filter(device => device.kind === 'audiooutput');
if (newSpeakerList.length > 0) {
setSelectedSpeaker({id : newSpeakerList[0].deviceId, label : newSpeakerList[0].label});
}
}
const getMics = async () => {
const mics = await getMicrophones();
const speakers = await getPlaybackDevices();
mics && mics?.length && setMics(mics);
speakers && speakers?.length && setSpeakers(speakers);
};
const [tooltipShow, setTooltipShow] = useState(false);
const btnRef = useRef();
const tooltipRef = useRef();
const openTooltip = () => {
createPopper(btnRef.current, tooltipRef.current, {
placement: "top",
});
setTooltipShow(true);
};
const closeTooltip = () => {
setTooltipShow(false);
};
return (
<>
<OutlinedButton
Icon={localMicOn ? MicOnIcon : MicOffIcon}
onClick={() => {
mMeeting.toggleMic();
}}
bgColor={localMicOn ? "bg-gray-750" : "bg-white"}
borderColor={localMicOn && "#ffffff33"}
isFocused={localMicOn}
focusIconColor={localMicOn && "white"}
tooltip={"Toggle Mic"}
renderRightComponent={() => {
return (
<>
<Popover className="relative">
{({ close }) => (
<>
<Popover.Button
disabled={!isMicrophonePermissionAllowed}
className="flex items-center justify-center mt-1 mr-1 focus:outline-none"
>
<div
ref={btnRef}
onMouseEnter={openTooltip}
onMouseLeave={closeTooltip}
>
<button
onClick={() => {
getMics();
}}
>
<ChevronDownIcon
className="h-4 w-4"
style={{
color: mMeeting.localMicOn ? "white" : "black",
}}
/>
</button>
</div>
</Popover.Button>
<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel className="absolute left-1/2 bottom-full z-10 mt-3 w-72 -translate-x-1/2 transform px-4 sm:px-0 pb-4">
<div className="overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5">
<div className={" bg-gray-750 py-1"}>
<div>
<div className="flex items-center p-3 pb-0">
<p className="ml-3 text-sm text-gray-900">
{"MICROPHONE"}
</p>
</div>
<div className="flex flex-col">
{mics.map(({ deviceId, label }, index) => (
<div
className={`px-3 py-1 my-1 pl-6 text-white text-left ${
deviceId === selectedMic.id &&
"bg-gray-150"
}`}
>
<button
className={`flex flex-1 w-full text-left ${
deviceId === selectedMic.id &&
"bg-gray-150"
}`}
key={`mics_${deviceId}`}
onClick={() => {
setSelectedMic({ id: deviceId });
changeMic(deviceId);
close();
}}
>
{label || `Mic ${index + 1}`}
</button>
</div>
))}
</div>
</div>
<hr className="border border-gray-50 mt-2 mb-1" />
<div>
<div className="flex p-3 pb-0">
<p className="ml-3 text-sm text-gray-900 text-center">
{"SPEAKER"}
</p>
</div>
<div className="flex flex-col ">
{speakers.map(({ deviceId, label }, index) => (
<div
className={`px-3 py-1 my-1 pl-6 text-white ${
deviceId === selectedSpeaker.id &&
"bg-gray-150"
}`}
>
<button
className={`flex flex-1 w-full text-left ${
deviceId === selectedSpeaker.id &&
"bg-gray-150"
}`}
key={`speakers_${deviceId}`}
onClick={() => {
setSelectedSpeaker({ id: deviceId });
close();
}}
>
{label || `Speaker ${index + 1}`}
</button>
</div>
))}
</div>
</div>
</div>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
<div
style={{ zIndex: 999 }}
className={`${
tooltipShow ? "" : "hidden"
} overflow-hidden flex flex-col items-center justify-center pb-4`}
ref={tooltipRef}
>
<div className={"rounded-md p-1.5 bg-black "}>
<p className="text-base text-white ">{"Change microphone"}</p>
</div>
</div>
</>
);
}}
/>
</>
);
};
const WebCamBTN = () => {
const { selectedWebcam, setSelectedWebcam, isCameraPermissionAllowed } =
useMeetingAppContext();
const { getCameras } = useMediaDevice();
const mMeeting = useMeeting();
const [webcams, setWebcams] = useState([]);
const { getVideoTrack } = useMediaStream();
const localWebcamOn = mMeeting?.localWebcamOn;
const changeWebcam = mMeeting?.changeWebcam;
const getWebcams = async () => {
let webcams = await getCameras();
webcams && webcams?.length && setWebcams(webcams);
};
const [tooltipShow, setTooltipShow] = useState(false);
const btnRef = useRef();
const tooltipRef = useRef();
const openTooltip = () => {
createPopper(btnRef.current, tooltipRef.current, {
placement: "top",
});
setTooltipShow(true);
};
const closeTooltip = () => {
setTooltipShow(false);
};
return (
<>
<OutlinedButton
Icon={localWebcamOn ? WebcamOnIcon : WebcamOffIcon}
onClick={async () => {
let track;
if (!localWebcamOn) {
track = await getVideoTrack({
webcamId: selectedWebcam.id,
});
}
mMeeting.toggleWebcam(track);
}}
bgColor={localWebcamOn ? "bg-gray-750" : "bg-white"}
borderColor={localWebcamOn && "#ffffff33"}
isFocused={localWebcamOn}
focusIconColor={localWebcamOn && "white"}
tooltip={"Toggle Webcam"}
renderRightComponent={() => {
return (
<>
<Popover className="relative">
{({ close }) => (
<>
<Popover.Button
disabled={!isCameraPermissionAllowed}
className="flex items-center justify-center mt-1 mr-1 focus:outline-none"
>
<div
ref={btnRef}
onMouseEnter={openTooltip}
onMouseLeave={closeTooltip}
>
<button
onClick={() => {
getWebcams();
}}
>
<ChevronDownIcon
className="h-4 w-4"
style={{
color: localWebcamOn ? "white" : "black",
}}
/>
</button>
</div>
</Popover.Button>
<Transition
as={Fragment}
enter="transition ease-out duration-200"
enterFrom="opacity-0 translate-y-1"
enterTo="opacity-100 translate-y-0"
leave="transition ease-in duration-150"
leaveFrom="opacity-100 translate-y-0"
leaveTo="opacity-0 translate-y-1"
>
<Popover.Panel className="absolute left-1/2 bottom-full z-10 mt-3 w-72 -translate-x-1/2 transform px-4 sm:px-0 pb-4">
<div className="overflow-hidden rounded-lg shadow-lg ring-1 ring-black ring-opacity-5">
<div className={" bg-gray-750 py-1"}>
<div>
<div className="flex items-center p-3 pb-0">
<p className="ml-3 text-sm text-gray-900">
{"WEBCAM"}
</p>
</div>
<div className="flex flex-col">
{webcams.map(({ deviceId, label }, index) => (
<div
className={`px-3 py-1 my-1 pl-6 text-white ${
deviceId === selectedWebcam.id &&
"bg-gray-150"
}`}
>
<button
className={`flex flex-1 w-full text-left ${
deviceId === selectedWebcam.id &&
"bg-gray-150"
}`}
key={`output_webcams_${deviceId}`}
onClick={() => {
setSelectedWebcam({ id: deviceId });
changeWebcam(deviceId);
close();
}}
>
{label || `Webcam ${index + 1}`}
</button>
</div>
))}
</div>
</div>
</div>
</div>
</Popover.Panel>
</Transition>
</>
)}
</Popover>
<div
style={{ zIndex: 999 }}
className={`${
tooltipShow ? "" : "hidden"
} overflow-hidden flex flex-col items-center justify-center pb-4`}
ref={tooltipRef}
>
<div className={"rounded-md p-1.5 bg-black "}>
<p className="text-base text-white ">{"Change webcam"}</p>
</div>
</div>
</>
);
}}
/>
</>
);
};
export function BottomBar({ bottomBarHeight, setIsMeetingLeft }) {
const { sideBarMode, setSideBarMode } = useMeetingAppContext();
const RaiseHandBTN = ({ isMobile, isTab }) => {
const { publish } = usePubSub("RAISE_HAND");
const RaiseHand = () => {
publish("Raise Hand");
};
return isMobile || isTab ? (
<MobileIconButton
id="RaiseHandBTN"
tooltipTitle={"Raise hand"}
Icon={RaiseHandIcon}
onClick={RaiseHand}
buttonText={"Raise Hand"}
/>
) : (
<OutlinedButton
onClick={RaiseHand}
tooltip={"Raise Hand"}
Icon={RaiseHandIcon}
/>
);
};
const RecordingBTN = () => {
const { startRecording, stopRecording, recordingState } = useMeeting();
const defaultOptions = {
loop: true,
autoplay: true,
animationData: recordingBlink,
rendererSettings: {
preserveAspectRatio: "xMidYMid slice",
},
height: 64,
width: 160,
};
const isRecording = useIsRecording();
const isRecordingRef = useRef(isRecording);
useEffect(() => {
isRecordingRef.current = isRecording;
}, [isRecording]);
const { isRequestProcessing } = useMemo(
() => ({
isRequestProcessing:
recordingState === Constants.recordingEvents.RECORDING_STARTING ||
recordingState === Constants.recordingEvents.RECORDING_STOPPING,
}),
[recordingState]
);
const _handleClick = () => {
const isRecording = isRecordingRef.current;
if (isRecording) {
stopRecording();
} else {
startRecording();
}
};
return (
<OutlinedButton
Icon={RecordingIcon}
onClick={_handleClick}
isFocused={isRecording}
tooltip={
recordingState === Constants.recordingEvents.RECORDING_STARTED
? "Stop Recording"
: recordingState === Constants.recordingEvents.RECORDING_STARTING
? "Starting Recording"
: recordingState === Constants.recordingEvents.RECORDING_STOPPED
? "Start Recording"
: recordingState === Constants.recordingEvents.RECORDING_STOPPING
? "Stopping Recording"
: "Start Recording"
}
lottieOption={isRecording ? defaultOptions : null}
isRequestProcessing={isRequestProcessing}
/>
);
};
const ScreenShareBTN = ({ isMobile, isTab }) => {
const { localScreenShareOn, toggleScreenShare, presenterId } = useMeeting();
return isMobile || isTab ? (
<MobileIconButton
id="screen-share-btn"
tooltipTitle={
presenterId
? localScreenShareOn
? "Stop Presenting"
: null
: "Present Screen"
}
buttonText={
presenterId
? localScreenShareOn
? "Stop Presenting"
: null
: "Present Screen"
}
isFocused={localScreenShareOn}
Icon={ScreenShareIcon}
onClick={() => {
toggleScreenShare();
}}
disabled={
presenterId
? localScreenShareOn
? false
: true
: isMobile
? true
: false
}
/>
) : (
<OutlinedButton
Icon={ScreenShareIcon}
onClick={() => {
toggleScreenShare();
}}
isFocused={localScreenShareOn}
tooltip={
presenterId
? localScreenShareOn
? "Stop Presenting"
: null
: "Present Screen"
}
disabled={presenterId ? (localScreenShareOn ? false : true) : false}
/>
);
};
const LeaveBTN = () => {
const { leave } = useMeeting();
return (
<OutlinedButton
Icon={EndIcon}
bgColor="bg-red-150"
onClick={() => {
leave();
setIsMeetingLeft(true);
}}
tooltip="Leave Meeting"
/>
);
};
const ChatBTN = ({ isMobile, isTab }) => {
return isMobile || isTab ? (
<MobileIconButton
tooltipTitle={"Chat"}
buttonText={"Chat"}
Icon={ChatIcon}
isFocused={sideBarMode === sideBarModes.CHAT}
onClick={() => {
setSideBarMode((s) =>
s === sideBarModes.CHAT ? null : sideBarModes.CHAT
);
}}
/>
) : (
<OutlinedButton
Icon={ChatIcon}
onClick={() => {
setSideBarMode((s) =>
s === sideBarModes.CHAT ? null : sideBarModes.CHAT
);
}}
isFocused={sideBarMode === "CHAT"}
tooltip="View Chat"
/>
);
};
const ParticipantsBTN = ({ isMobile, isTab }) => {
const { participants } = useMeeting();
return isMobile || isTab ? (
<MobileIconButton
tooltipTitle={"Participants"}
isFocused={sideBarMode === sideBarModes.PARTICIPANTS}
buttonText={"Participants"}
disabledOpacity={1}
Icon={ParticipantsIcon}
onClick={() => {
setSideBarMode((s) =>
s === sideBarModes.PARTICIPANTS ? null : sideBarModes.PARTICIPANTS
);
}}
badge={`${new Map(participants)?.size}`}
/>
) : (
<OutlinedButton
Icon={ParticipantsIcon}
onClick={() => {
setSideBarMode((s) =>
s === sideBarModes.PARTICIPANTS ? null : sideBarModes.PARTICIPANTS
);
}}
isFocused={sideBarMode === sideBarModes.PARTICIPANTS}
tooltip={"View \nParticipants"}
badge={`${new Map(participants)?.size}`}
/>
);
};
const MeetingIdCopyBTN = () => {
const { meetingId } = useMeeting();
const [isCopied, setIsCopied] = useState(false);
return (
<div className="flex items-center justify-center lg:ml-0 ml-4 mt-4 xl:mt-0">
<div className="flex border-2 border-gray-850 p-2 rounded-md items-center justify-center">
<h1 className="text-white text-base ">{meetingId}</h1>
<button
className="ml-2"
onClick={() => {
navigator.clipboard.writeText(meetingId);
setIsCopied(true);
setTimeout(() => {
setIsCopied(false);
}, 3000);
}}
>
{isCopied ? (
<CheckIcon className="h-5 w-5 text-green-400" />
) : (
<ClipboardIcon className="h-5 w-5 text-white" />
)}
</button>
</div>
</div>
);
};
const tollTipEl = useRef();
const isMobile = useIsMobile();
const isTab = useIsTab();
const [open, setOpen] = useState(false);
const handleClickFAB = () => {
setOpen(true);
};
const handleCloseFAB = () => {
setOpen(false);
};
const BottomBarButtonTypes = useMemo(
() => ({
END_CALL: "END_CALL",
CHAT: "CHAT",
PARTICIPANTS: "PARTICIPANTS",
SCREEN_SHARE: "SCREEN_SHARE",
WEBCAM: "WEBCAM",
MIC: "MIC",
RAISE_HAND: "RAISE_HAND",
RECORDING: "RECORDING",
PIP: "PIP",
MEETING_ID_COPY: "MEETING_ID_COPY",
}),
[]
);
const otherFeatures = [
{ icon: BottomBarButtonTypes.RAISE_HAND },
{ icon: BottomBarButtonTypes.PIP },
{ icon: BottomBarButtonTypes.SCREEN_SHARE },
{ icon: BottomBarButtonTypes.CHAT },
{ icon: BottomBarButtonTypes.PARTICIPANTS },
{ icon: BottomBarButtonTypes.MEETING_ID_COPY },
];
return isMobile || isTab ? (
<div
className="flex items-center justify-center"
style={{ height: bottomBarHeight }}
>
<LeaveBTN />
<MicBTN />
<WebCamBTN />
<RecordingBTN />
<OutlinedButton Icon={DotsHorizontalIcon} onClick={handleClickFAB} />
<Transition appear show={Boolean(open)} as={Fragment}>
<Dialog
as="div"
className="relative"
style={{ zIndex: 9999 }}
onClose={handleCloseFAB}
>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="opacity-0"
enterTo="opacity-100"
leave="ease-in duration-200"
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<div className="fixed inset-0 bg-black bg-opacity-25" />
</Transition.Child>
<Transition.Child
as={Fragment}
enter="ease-out duration-300"
enterFrom="translate-y-full opacity-0 scale-95"
enterTo="translate-y-0 opacity-100 scale-100"
leave="ease-in duration-200"
leaveFrom="translate-y-0 opacity-100 scale-100"
leaveTo="translate-y-full opacity-0 scale-95"
>
<div className="fixed inset-0 overflow-y-hidden">
<div className="flex h-full items-end justify-end text-center">
<Dialog.Panel className="w-screen transform overflow-hidden bg-gray-800 shadow-xl transition-all">
<div className="grid container bg-gray-800 py-6">
<div className="grid grid-cols-12 gap-2">
{otherFeatures.map(({ icon }) => {
return (
<div
className={`grid items-center justify-center ${
icon === BottomBarButtonTypes.MEETING_ID_COPY
? "col-span-7 sm:col-span-5 md:col-span-3"
: "col-span-4 sm:col-span-3 md:col-span-2"
}`}
>
{icon === BottomBarButtonTypes.RAISE_HAND ? (
<RaiseHandBTN isMobile={isMobile} isTab={isTab} />
) : icon === BottomBarButtonTypes.SCREEN_SHARE ? (
<ScreenShareBTN
isMobile={isMobile}
isTab={isTab}
/>
) : icon === BottomBarButtonTypes.CHAT ? (
<ChatBTN isMobile={isMobile} isTab={isTab} />
) : icon === BottomBarButtonTypes.PARTICIPANTS ? (
<ParticipantsBTN
isMobile={isMobile}
isTab={isTab}
/>
) : icon ===
BottomBarButtonTypes.MEETING_ID_COPY ? (
<MeetingIdCopyBTN
isMobile={isMobile}
isTab={isTab}
/>
) : icon === BottomBarButtonTypes.PIP ? (
<PipBTN isMobile={isMobile} isTab={isTab} />
) : null}
</div>
);
})}
</div>
</div>
</Dialog.Panel>
</div>
</div>
</Transition.Child>
</Dialog>
</Transition>
</div>
) : (
<div className="md:flex lg:px-2 xl:px-6 pb-2 px-2 hidden">
<MeetingIdCopyBTN />
<div className="flex flex-1 items-center justify-center" ref={tollTipEl}>
<RecordingBTN />
<RaiseHandBTN isMobile={isMobile} isTab={isTab} />
<MicBTN />
<WebCamBTN />
<ScreenShareBTN isMobile={isMobile} isTab={isTab} />
<PipBTN isMobile={isMobile} isTab={isTab} />
<LeaveBTN />
</div>
<div className="flex items-center justify-center">
<ChatBTN isMobile={isMobile} isTab={isTab} />
<ParticipantsBTN isMobile={isMobile} isTab={isTab} />
</div>
</div>
);
}