@100mslive/roomkit-react 0.1.5 → 0.1.6-alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-P57IRMAR.js → HLSView-HNVYG5VE.js} +309 -151
- package/dist/HLSView-HNVYG5VE.js.map +7 -0
- package/dist/Prebuilt/App.d.ts +3 -0
- package/dist/Prebuilt/AppContext.d.ts +13 -0
- package/dist/Prebuilt/common/PeersSorter.d.ts +21 -0
- package/dist/Prebuilt/components/Chat/ChatFooter.d.ts +7 -0
- package/dist/Prebuilt/components/Connection/ConnectionIndicator.d.ts +6 -0
- package/dist/Prebuilt/components/Connection/TileConnection.d.ts +10 -0
- package/dist/Prebuilt/components/Footer/ChatToggle.d.ts +4 -0
- package/dist/Prebuilt/components/Footer/Footer.d.ts +6 -0
- package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +14 -0
- package/dist/Prebuilt/components/Footer/RoleOptions.d.ts +6 -0
- package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
- package/dist/Prebuilt/components/Header/StreamActions.d.ts +11 -0
- package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
- package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +8 -0
- package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +9 -0
- package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
- package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +11 -0
- package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
- package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +8 -0
- package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +8 -0
- package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
- package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
- package/dist/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.d.ts +6 -0
- package/dist/Prebuilt/components/Pagination.d.ts +6 -0
- package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +3 -0
- package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
- package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +16 -0
- package/dist/Prebuilt/components/RoleChangeRequestModal.d.ts +2 -0
- package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +6 -0
- package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +12 -0
- package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +15 -0
- package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
- package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +9 -0
- package/dist/Prebuilt/components/hooks/useAutoStartStreaming.d.ts +1 -0
- package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +3 -0
- package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
- package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +13 -0
- package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +13 -0
- package/dist/Prebuilt/layouts/SidePane.d.ts +9 -0
- package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +7 -0
- package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
- package/dist/{VirtualBackground-GGCQJ5JM.js → VirtualBackground-UM2FOUHQ.js} +5 -11
- package/dist/VirtualBackground-UM2FOUHQ.js.map +7 -0
- package/dist/{chunk-P5X32KOD.js → chunk-364HP22I.js} +8 -5
- package/dist/chunk-364HP22I.js.map +7 -0
- package/dist/{chunk-OSM4QEQG.js → chunk-LYSAET4G.js} +3742 -5462
- package/dist/chunk-LYSAET4G.js.map +7 -0
- package/dist/chunk-POE7H4IE.js +898 -0
- package/dist/chunk-POE7H4IE.js.map +7 -0
- package/dist/conference-UWLJHMB2.js +5727 -0
- package/dist/conference-UWLJHMB2.js.map +7 -0
- package/dist/index.cjs.js +9655 -15326
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +2 -2
- package/dist/meta.cjs.json +2513 -3456
- package/dist/meta.esbuild.json +2807 -3838
- package/package.json +8 -7
- package/src/Button/Button.tsx +2 -2
- package/src/Prebuilt/App.tsx +58 -53
- package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
- package/src/Prebuilt/IconButton.jsx +11 -0
- package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
- package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +16 -11
- package/src/Prebuilt/common/constants.js +4 -114
- package/src/Prebuilt/common/hooks.js +34 -1
- package/src/Prebuilt/common/utils.js +1 -9
- package/src/Prebuilt/components/AppData/AppData.jsx +11 -15
- package/src/Prebuilt/components/AppData/useUISettings.js +6 -10
- package/src/Prebuilt/components/AudioVideoToggle.jsx +10 -2
- package/src/Prebuilt/components/AuthToken.jsx +11 -42
- package/src/Prebuilt/components/Chat/Chat.jsx +75 -27
- package/src/Prebuilt/components/Chat/ChatBody.jsx +95 -36
- package/src/Prebuilt/components/Chat/ChatFooter.tsx +199 -0
- package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +84 -0
- package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
- package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
- package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +5 -4
- package/src/Prebuilt/components/Connection/{ConnectionIndicator.jsx → ConnectionIndicator.tsx} +12 -4
- package/src/Prebuilt/components/Connection/TileConnection.tsx +71 -0
- package/src/Prebuilt/components/EmojiReaction.jsx +19 -22
- package/src/Prebuilt/components/Footer/{ChatToggle.jsx → ChatToggle.tsx} +13 -9
- package/src/Prebuilt/components/Footer/Footer.tsx +98 -0
- package/src/Prebuilt/components/Footer/ParticipantList.jsx +187 -179
- package/src/Prebuilt/components/Footer/RoleAccordion.tsx +94 -0
- package/src/Prebuilt/components/Footer/RoleOptions.tsx +155 -0
- package/src/Prebuilt/components/FullPageProgress.jsx +3 -3
- package/src/Prebuilt/components/HMSVideo/Controls.jsx +3 -2
- package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +63 -18
- package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -2
- package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
- package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +5 -6
- package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
- package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
- package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
- package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
- package/src/Prebuilt/components/Header/{StreamActions.jsx → StreamActions.tsx} +54 -67
- package/src/Prebuilt/components/Header/common.jsx +5 -2
- package/src/Prebuilt/components/Header/index.tsx +1 -0
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +23 -4
- package/src/Prebuilt/components/InsetTile.tsx +128 -0
- package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +67 -25
- package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +18 -11
- package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
- package/src/Prebuilt/components/Leave/LeaveCard.tsx +36 -0
- package/src/Prebuilt/components/Leave/LeaveRoom.tsx +66 -0
- package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +20 -6
- package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +43 -18
- package/src/Prebuilt/components/MetaActions.jsx +15 -23
- package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +16 -7
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
- package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
- package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +216 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx} +107 -45
- package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
- package/src/Prebuilt/components/Notifications/Notifications.jsx +46 -30
- package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
- package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
- package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +5 -11
- package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
- package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
- package/src/Prebuilt/components/Pagination.tsx +60 -0
- package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
- package/src/Prebuilt/components/PostLeave.jsx +7 -7
- package/src/Prebuilt/components/Preview/{PreviewContainer.jsx → PreviewContainer.tsx} +16 -15
- package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +16 -8
- package/src/Prebuilt/components/Preview/{PreviewJoin.jsx → PreviewJoin.tsx} +48 -22
- package/src/Prebuilt/components/RaiseHand.jsx +0 -7
- package/src/Prebuilt/components/RoleChangeRequestModal.tsx +119 -0
- package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
- package/src/Prebuilt/components/ScreenshareTile.jsx +43 -36
- package/src/Prebuilt/components/SecondaryTiles.tsx +36 -0
- package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
- package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
- package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
- package/src/Prebuilt/components/TileMenu/TileMenu.jsx +16 -17
- package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +33 -27
- package/src/Prebuilt/components/Toast/ToastConfig.jsx +58 -15
- package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +65 -0
- package/src/Prebuilt/components/VideoLayouts/Grid.tsx +43 -0
- package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +110 -0
- package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +74 -0
- package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +59 -0
- package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +52 -0
- package/src/Prebuilt/components/VideoLayouts/interface.ts +10 -0
- package/src/Prebuilt/components/VideoTile.jsx +116 -74
- package/src/Prebuilt/components/conference.jsx +86 -85
- package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +57 -0
- package/src/Prebuilt/components/hooks/useMetadata.jsx +19 -3
- package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +34 -0
- package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
- package/src/Prebuilt/components/hooks/useTileLayout.tsx +127 -0
- package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +26 -0
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
- package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
- package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
- package/src/Prebuilt/images/empty-chat.svg +12 -0
- package/src/Prebuilt/layouts/EmbedView.jsx +17 -50
- package/src/Prebuilt/layouts/HLSView.jsx +138 -51
- package/src/Prebuilt/layouts/PDFView.jsx +1 -11
- package/src/Prebuilt/layouts/SidePane.tsx +108 -0
- package/src/Prebuilt/layouts/VideoStreamingSection.tsx +96 -0
- package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
- package/src/Prebuilt/plugins/FlyingEmoji.jsx +14 -2
- package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
- package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
- package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
- package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
- package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
- package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
- package/src/Prebuilt/services/FeatureFlags.jsx +0 -1
- package/src/VideoTile/StyledVideoTile.tsx +1 -0
- package/dist/HLSView-P57IRMAR.js.map +0 -7
- package/dist/PinnedTrackView-4FYJEBTB.js +0 -102
- package/dist/PinnedTrackView-4FYJEBTB.js.map +0 -7
- package/dist/VirtualBackground-GGCQJ5JM.js.map +0 -7
- package/dist/chunk-IVTWKQI3.js +0 -827
- package/dist/chunk-IVTWKQI3.js.map +0 -7
- package/dist/chunk-OSM4QEQG.js.map +0 -7
- package/dist/chunk-P5X32KOD.js.map +0 -7
- package/dist/chunk-RVCZPPTL.js +0 -1100
- package/dist/chunk-RVCZPPTL.js.map +0 -7
- package/dist/conference-P6I6ESVF.js +0 -8995
- package/dist/conference-P6I6ESVF.js.map +0 -7
- package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +0 -16
- package/src/Prebuilt/components/Chat/ChatFooter.jsx +0 -150
- package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
- package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -39
- package/src/Prebuilt/components/EqualProminence.jsx +0 -180
- package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
- package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
- package/src/Prebuilt/components/Header/Header.jsx +0 -8
- package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
- package/src/Prebuilt/components/LeaveCard.jsx +0 -19
- package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
- package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +0 -219
- package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
- package/src/Prebuilt/components/Pagination.jsx +0 -29
- package/src/Prebuilt/components/RoleChangeRequestModal.jsx +0 -26
- package/src/Prebuilt/components/VideoList.jsx +0 -73
- package/src/Prebuilt/components/gridView.jsx +0 -85
- package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
- package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
- package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
- package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
- package/src/Prebuilt/images/Logo.svg +0 -8
- package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
- package/src/Prebuilt/layouts/InsetView.jsx +0 -260
- package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
- package/src/Prebuilt/layouts/SidePane.jsx +0 -52
- package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
- package/src/Prebuilt/layouts/mainView.jsx +0 -141
- package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
- /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
- /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
- /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
- /package/src/{assets → Prebuilt/images}/ios-perm-0.png +0 -0
package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx}
RENAMED
@@ -1,31 +1,55 @@
|
|
1
|
-
import React, {
|
1
|
+
import React, { useRef, useState } from 'react';
|
2
2
|
import { useClickAway } from 'react-use';
|
3
|
+
import { ConferencingScreen, DefaultConferencingScreen_Elements } from '@100mslive/types-prebuilt';
|
3
4
|
import {
|
4
5
|
selectIsConnectedToRoom,
|
5
|
-
selectIsLocalVideoEnabled,
|
6
6
|
selectPeerCount,
|
7
7
|
selectPermissions,
|
8
8
|
useHMSActions,
|
9
9
|
useHMSStore,
|
10
10
|
useRecordingStreaming,
|
11
11
|
} from '@100mslive/react-sdk';
|
12
|
-
import {
|
13
|
-
|
12
|
+
import {
|
13
|
+
BrbIcon,
|
14
|
+
CrossIcon,
|
15
|
+
DragHandleIcon,
|
16
|
+
EmojiIcon,
|
17
|
+
HandIcon,
|
18
|
+
HandRaiseSlashedIcon,
|
19
|
+
PeopleIcon,
|
20
|
+
RecordIcon,
|
21
|
+
SettingsIcon,
|
22
|
+
} from '@100mslive/react-icons';
|
23
|
+
import { Box, Loading, Tooltip } from '../../../..';
|
14
24
|
import { Sheet } from '../../../../Sheet';
|
25
|
+
// @ts-ignore: No implicit any
|
15
26
|
import IconButton from '../../../IconButton';
|
16
|
-
|
27
|
+
// @ts-ignore: No implicit any
|
28
|
+
import { EmojiReaction } from '../../EmojiReaction';
|
29
|
+
// @ts-ignore: No implicit any
|
17
30
|
import { StopRecordingInSheet } from '../../Header/StreamActions';
|
31
|
+
// @ts-ignore: No implicit any
|
18
32
|
import SettingsModal from '../../Settings/SettingsModal';
|
33
|
+
// @ts-ignore: No implicit any
|
19
34
|
import { ToastManager } from '../../Toast/ToastManager';
|
20
|
-
|
21
|
-
import {
|
22
|
-
|
35
|
+
// @ts-ignore: No implicit any
|
36
|
+
import { ActionTile } from '../ActionTile';
|
37
|
+
// @ts-ignore: No implicit any
|
38
|
+
import { ChangeNameModal } from '../ChangeNameModal';
|
39
|
+
// @ts-ignore: No implicit any
|
40
|
+
import { MuteAllModal } from '../MuteAllModal';
|
41
|
+
// @ts-ignore: No implicit any
|
23
42
|
import { useSidepaneToggle } from '../../AppData/useSidepane';
|
43
|
+
// @ts-ignore: No implicit any
|
24
44
|
import { useDropdownList } from '../../hooks/useDropdownList';
|
45
|
+
// @ts-ignore: No implicit any
|
46
|
+
import { useMyMetadata } from '../../hooks/useMetadata';
|
47
|
+
// @ts-ignore: No implicit any
|
25
48
|
import { getFormattedCount } from '../../../common/utils';
|
49
|
+
// @ts-ignore: No implicit any
|
26
50
|
import { SIDE_PANE_OPTIONS } from '../../../common/constants';
|
27
51
|
|
28
|
-
const VirtualBackground = React.lazy(() => import('../../../plugins/VirtualBackground/VirtualBackground'));
|
52
|
+
// const VirtualBackground = React.lazy(() => import('../../../plugins/VirtualBackground/VirtualBackground'));
|
29
53
|
|
30
54
|
const MODALS = {
|
31
55
|
CHANGE_NAME: 'changeName',
|
@@ -39,14 +63,18 @@ const MODALS = {
|
|
39
63
|
EMBED_URL: 'embedUrl',
|
40
64
|
};
|
41
65
|
|
42
|
-
export const MwebOptions = (
|
66
|
+
export const MwebOptions = ({
|
67
|
+
elements,
|
68
|
+
screenType,
|
69
|
+
}: {
|
70
|
+
elements: DefaultConferencingScreen_Elements;
|
71
|
+
screenType: keyof ConferencingScreen;
|
72
|
+
}) => {
|
43
73
|
const hmsActions = useHMSActions();
|
44
74
|
const permissions = useHMSStore(selectPermissions);
|
45
75
|
const isConnected = useHMSStore(selectIsConnectedToRoom);
|
46
76
|
const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
|
47
|
-
|
48
77
|
const [openModals, setOpenModals] = useState(new Set());
|
49
|
-
|
50
78
|
const [openOptionsSheet, setOpenOptionsSheet] = useState(false);
|
51
79
|
const [openSettingsSheet, setOpenSettingsSheet] = useState(false);
|
52
80
|
const [showEmojiCard, setShowEmojiCard] = useState(false);
|
@@ -55,11 +83,12 @@ export const MwebOptions = () => {
|
|
55
83
|
const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
|
56
84
|
const peerCount = useHMSStore(selectPeerCount);
|
57
85
|
const emojiCardRef = useRef(null);
|
58
|
-
const
|
86
|
+
const { isBRBOn, toggleBRB, isHandRaised, toggleHandRaise } = useMyMetadata();
|
87
|
+
// const isVideoOn = useHMSStore(selectIsLocalVideoEnabled);
|
59
88
|
|
60
|
-
useDropdownList({ open: openModals.size > 0, name: 'MoreSettings' });
|
89
|
+
useDropdownList({ open: openModals.size > 0 || openOptionsSheet || openSettingsSheet, name: 'MoreSettings' });
|
61
90
|
|
62
|
-
const updateState = (modalName, value) => {
|
91
|
+
const updateState = (modalName: string, value: boolean) => {
|
63
92
|
setOpenModals(modals => {
|
64
93
|
const copy = new Set(modals);
|
65
94
|
if (value) {
|
@@ -76,13 +105,13 @@ export const MwebOptions = () => {
|
|
76
105
|
return (
|
77
106
|
<>
|
78
107
|
<Sheet.Root open={openOptionsSheet} onOpenChange={setOpenOptionsSheet}>
|
79
|
-
<
|
80
|
-
<
|
81
|
-
<
|
108
|
+
<Tooltip title="More options">
|
109
|
+
<Sheet.Trigger asChild data-testid="more_settings_btn">
|
110
|
+
<IconButton>
|
82
111
|
<DragHandleIcon />
|
83
|
-
</
|
84
|
-
</
|
85
|
-
</
|
112
|
+
</IconButton>
|
113
|
+
</Sheet.Trigger>
|
114
|
+
</Tooltip>
|
86
115
|
<Sheet.Content css={{ bg: '$surface_dim', pb: '$14' }}>
|
87
116
|
<Sheet.Title
|
88
117
|
css={{
|
@@ -116,32 +145,62 @@ export const MwebOptions = () => {
|
|
116
145
|
px: '$9',
|
117
146
|
}}
|
118
147
|
>
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
148
|
+
{elements?.participant_list && (
|
149
|
+
<ActionTile.Root
|
150
|
+
onClick={() => {
|
151
|
+
toggleParticipants();
|
152
|
+
setOpenOptionsSheet(false);
|
153
|
+
}}
|
154
|
+
>
|
155
|
+
<ActionTile.Count>{getFormattedCount(peerCount)}</ActionTile.Count>
|
156
|
+
<PeopleIcon />
|
157
|
+
<ActionTile.Title>Participants</ActionTile.Title>
|
158
|
+
</ActionTile.Root>
|
159
|
+
)}
|
129
160
|
|
130
|
-
{
|
161
|
+
{screenType !== 'hls_live_streaming' ? (
|
162
|
+
<ActionTile.Root
|
163
|
+
active={isHandRaised}
|
164
|
+
onClick={() => {
|
165
|
+
toggleHandRaise();
|
166
|
+
setOpenOptionsSheet(false);
|
167
|
+
}}
|
168
|
+
>
|
169
|
+
{isHandRaised ? <HandRaiseSlashedIcon /> : <HandIcon />}
|
170
|
+
<ActionTile.Title>{isHandRaised ? 'Lower' : 'Raise'} Hand</ActionTile.Title>
|
171
|
+
</ActionTile.Root>
|
172
|
+
) : null}
|
173
|
+
|
174
|
+
{/* {isVideoOn ? (
|
131
175
|
<Suspense fallback="">
|
132
176
|
<VirtualBackground asActionTile onVBClick={() => setOpenOptionsSheet(false)} />
|
133
177
|
</Suspense>
|
134
|
-
) : null}
|
178
|
+
) : null} */}
|
135
179
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
180
|
+
{elements?.emoji_reactions && (
|
181
|
+
<ActionTile.Root
|
182
|
+
onClick={() => {
|
183
|
+
setShowEmojiCard(true);
|
184
|
+
setOpenOptionsSheet(false);
|
185
|
+
}}
|
186
|
+
>
|
187
|
+
<EmojiIcon />
|
188
|
+
<ActionTile.Title>Emoji Reactions</ActionTile.Title>
|
189
|
+
</ActionTile.Root>
|
190
|
+
)}
|
191
|
+
|
192
|
+
{elements?.brb && (
|
193
|
+
<ActionTile.Root
|
194
|
+
active={isBRBOn}
|
195
|
+
onClick={() => {
|
196
|
+
toggleBRB();
|
197
|
+
setOpenOptionsSheet(false);
|
198
|
+
}}
|
199
|
+
>
|
200
|
+
<BrbIcon />
|
201
|
+
<ActionTile.Title>Be Right Back</ActionTile.Title>
|
202
|
+
</ActionTile.Root>
|
203
|
+
)}
|
145
204
|
|
146
205
|
<ActionTile.Root
|
147
206
|
onClick={() => {
|
@@ -173,6 +232,7 @@ export const MwebOptions = () => {
|
|
173
232
|
setOpenOptionsSheet(false);
|
174
233
|
setIsRecordingLoading(false);
|
175
234
|
} catch (error) {
|
235
|
+
// @ts-ignore
|
176
236
|
if (error.message.includes('stream already running')) {
|
177
237
|
ToastManager.addToast({
|
178
238
|
title: 'Recording already running',
|
@@ -180,6 +240,7 @@ export const MwebOptions = () => {
|
|
180
240
|
});
|
181
241
|
} else {
|
182
242
|
ToastManager.addToast({
|
243
|
+
// @ts-ignore
|
183
244
|
title: error.message,
|
184
245
|
variant: 'error',
|
185
246
|
});
|
@@ -207,11 +268,11 @@ export const MwebOptions = () => {
|
|
207
268
|
</Sheet.Root>
|
208
269
|
<SettingsModal open={openSettingsSheet} onOpenChange={setOpenSettingsSheet} />
|
209
270
|
{openModals.has(MODALS.MUTE_ALL) && (
|
210
|
-
<MuteAllModal onOpenChange={value => updateState(MODALS.MUTE_ALL, value)} isMobile />
|
271
|
+
<MuteAllModal onOpenChange={(value: boolean) => updateState(MODALS.MUTE_ALL, value)} isMobile />
|
211
272
|
)}
|
212
273
|
{openModals.has(MODALS.CHANGE_NAME) && (
|
213
274
|
<ChangeNameModal
|
214
|
-
onOpenChange={value => updateState(MODALS.CHANGE_NAME, value)}
|
275
|
+
onOpenChange={(value: boolean) => updateState(MODALS.CHANGE_NAME, value)}
|
215
276
|
openParentSheet={() => setOpenOptionsSheet(true)}
|
216
277
|
/>
|
217
278
|
)}
|
@@ -235,7 +296,7 @@ export const MwebOptions = () => {
|
|
235
296
|
mx: '$4',
|
236
297
|
}}
|
237
298
|
>
|
238
|
-
<
|
299
|
+
<EmojiReaction />
|
239
300
|
</Box>
|
240
301
|
)}
|
241
302
|
{showRecordingOn && (
|
@@ -247,6 +308,7 @@ export const MwebOptions = () => {
|
|
247
308
|
setShowRecordingOn(false);
|
248
309
|
} catch (error) {
|
249
310
|
ToastManager.addToast({
|
311
|
+
// @ts-ignore
|
250
312
|
title: error.message,
|
251
313
|
variant: 'error',
|
252
314
|
});
|
@@ -60,7 +60,9 @@ export function HLSFailureModal() {
|
|
60
60
|
<Button outlined variant="standard" css={{ w: '100%' }} onClick={() => setOpenModal(false)}>
|
61
61
|
Dismiss
|
62
62
|
</Button>
|
63
|
-
<Button css={{ w: '100%' }}
|
63
|
+
<Button css={{ w: '100%' }} onClick={startHLS}>
|
64
|
+
Go Live
|
65
|
+
</Button>
|
64
66
|
</Flex>
|
65
67
|
</Dialog.Content>
|
66
68
|
</Dialog.Portal>
|
@@ -1,43 +1,66 @@
|
|
1
1
|
/* eslint-disable no-case-declarations */
|
2
|
-
import React, { useEffect } from 'react';
|
3
|
-
import {
|
2
|
+
import React, { useCallback, useEffect } from 'react';
|
3
|
+
import { useNavigate, useParams } from 'react-router-dom';
|
4
|
+
import {
|
5
|
+
HMSNotificationTypes,
|
6
|
+
HMSRoomState,
|
7
|
+
selectRoomState,
|
8
|
+
useCustomEvent,
|
9
|
+
useHMSNotifications,
|
10
|
+
useHMSStore,
|
11
|
+
} from '@100mslive/react-sdk';
|
4
12
|
import { Button } from '../../../';
|
13
|
+
import { useUpdateRoomLayout } from '../../provider/roomLayoutProvider';
|
5
14
|
import { ToastBatcher } from '../Toast/ToastBatcher';
|
6
15
|
import { ToastManager } from '../Toast/ToastManager';
|
7
16
|
import { AutoplayBlockedModal } from './AutoplayBlockedModal';
|
8
17
|
import { InitErrorModal } from './InitErrorModal';
|
9
|
-
import { MessageNotifications } from './MessageNotifications';
|
10
18
|
import { PeerNotifications } from './PeerNotifications';
|
11
19
|
import { PermissionErrorModal } from './PermissionErrorModal';
|
12
20
|
import { ReconnectNotifications } from './ReconnectNotifications';
|
13
21
|
import { TrackBulkUnmuteModal } from './TrackBulkUnmuteModal';
|
14
22
|
import { TrackNotifications } from './TrackNotifications';
|
15
23
|
import { TrackUnmuteModal } from './TrackUnmuteModal';
|
16
|
-
import {
|
17
|
-
import {
|
24
|
+
import { useIsNotificationDisabled, useSubscribedNotifications } from '../AppData/useUISettings';
|
25
|
+
import { useRedirectToLeave } from '../hooks/useRedirectToLeave';
|
18
26
|
import { getMetadata } from '../../common/utils';
|
19
|
-
|
27
|
+
import { ROLE_CHANGE_DECLINED } from '../../common/constants';
|
20
28
|
export function Notifications() {
|
21
29
|
const notification = useHMSNotifications();
|
22
|
-
const navigate =
|
23
|
-
const
|
30
|
+
const navigate = useNavigate();
|
31
|
+
const params = useParams();
|
24
32
|
const subscribedNotifications = useSubscribedNotifications() || {};
|
25
|
-
const
|
33
|
+
const roomState = useHMSStore(selectRoomState);
|
34
|
+
const updateRoomLayoutForRole = useUpdateRoomLayout();
|
35
|
+
const isNotificationDisabled = useIsNotificationDisabled();
|
36
|
+
const { redirectToLeave } = useRedirectToLeave();
|
37
|
+
|
38
|
+
const handleRoleChangeDenied = useCallback(request => {
|
39
|
+
ToastManager.addToast({
|
40
|
+
title: `${request.peerName} denied your request to join the ${request.role.name} role`,
|
41
|
+
variant: 'error',
|
42
|
+
});
|
43
|
+
}, []);
|
44
|
+
|
45
|
+
useCustomEvent({ type: ROLE_CHANGE_DECLINED, onEvent: handleRoleChangeDenied });
|
26
46
|
|
27
47
|
useEffect(() => {
|
28
|
-
if (!notification) {
|
48
|
+
if (!notification || isNotificationDisabled) {
|
29
49
|
return;
|
30
50
|
}
|
31
51
|
switch (notification.type) {
|
32
52
|
case HMSNotificationTypes.METADATA_UPDATED:
|
53
|
+
if (roomState !== HMSRoomState.Connected) {
|
54
|
+
return;
|
55
|
+
}
|
33
56
|
// Don't toast message when metadata is updated and raiseHand is false.
|
34
57
|
// Don't toast message in case of local peer.
|
35
58
|
const metadata = getMetadata(notification.data?.metadata);
|
36
|
-
if (!metadata?.isHandRaised || notification.data.isLocal
|
59
|
+
if (!metadata?.isHandRaised || notification.data.isLocal) return;
|
37
60
|
|
38
61
|
console.debug('Metadata updated', notification.data);
|
39
62
|
if (!subscribedNotifications.METADATA_UPDATED) return;
|
40
|
-
ToastBatcher.showToast({ notification });
|
63
|
+
ToastBatcher.showToast({ notification, type: 'RAISE_HAND' });
|
41
64
|
break;
|
42
65
|
case HMSNotificationTypes.NAME_UPDATED:
|
43
66
|
console.log(notification.data.id + ' changed their name to ' + notification.data.name);
|
@@ -59,7 +82,7 @@ export function Notifications() {
|
|
59
82
|
<Button
|
60
83
|
onClick={() => {
|
61
84
|
ToastManager.removeToast(toastId);
|
62
|
-
|
85
|
+
navigate(`/${params.roomId}${params.role ? `/${params.role}` : ''}`);
|
63
86
|
}}
|
64
87
|
>
|
65
88
|
Rejoin
|
@@ -70,11 +93,7 @@ export function Notifications() {
|
|
70
93
|
}
|
71
94
|
// goto leave for terminal if any action is not performed within 2secs
|
72
95
|
// if network is still unavailable going to preview will throw an error
|
73
|
-
|
74
|
-
const previewLocation = window.location.pathname.replace('meeting', 'leave');
|
75
|
-
ToastManager.clearAllToast();
|
76
|
-
navigate(previewLocation);
|
77
|
-
}, 2000);
|
96
|
+
redirectToLeave(1000);
|
78
97
|
return;
|
79
98
|
}
|
80
99
|
// Autoplay error or user denied screen share (cancelled browser pop-up)
|
@@ -90,13 +109,11 @@ export function Notifications() {
|
|
90
109
|
});
|
91
110
|
break;
|
92
111
|
case HMSNotificationTypes.ROLE_UPDATED:
|
93
|
-
if (notification.data.roleName === HLS_VIEWER_ROLE) {
|
94
|
-
return;
|
95
|
-
}
|
96
112
|
if (notification.data?.isLocal) {
|
97
113
|
ToastManager.addToast({
|
98
114
|
title: `You are now a ${notification.data.roleName}`,
|
99
115
|
});
|
116
|
+
updateRoomLayoutForRole(notification.data.roleName);
|
100
117
|
}
|
101
118
|
break;
|
102
119
|
case HMSNotificationTypes.CHANGE_TRACK_STATE_REQUEST:
|
@@ -114,11 +131,7 @@ export function Notifications() {
|
|
114
131
|
title: `${notification.message}.
|
115
132
|
${notification.data.reason && `Reason: ${notification.data.reason}`}`,
|
116
133
|
});
|
117
|
-
|
118
|
-
const leaveLocation = window.location.pathname.replace('meeting', 'leave');
|
119
|
-
navigate(leaveLocation);
|
120
|
-
ToastManager.clearAllToast();
|
121
|
-
}, 2000);
|
134
|
+
redirectToLeave(1000);
|
122
135
|
break;
|
123
136
|
case HMSNotificationTypes.DEVICE_CHANGE_UPDATE:
|
124
137
|
ToastManager.addToast({
|
@@ -129,18 +142,21 @@ export function Notifications() {
|
|
129
142
|
break;
|
130
143
|
}
|
131
144
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
132
|
-
}, [notification, subscribedNotifications.ERROR, subscribedNotifications.METADATA_UPDATED
|
145
|
+
}, [notification, subscribedNotifications.ERROR, subscribedNotifications.METADATA_UPDATED]);
|
146
|
+
|
147
|
+
if (isNotificationDisabled) {
|
148
|
+
return null;
|
149
|
+
}
|
133
150
|
|
134
151
|
return (
|
135
152
|
<>
|
136
|
-
|
137
|
-
|
153
|
+
<TrackUnmuteModal />
|
154
|
+
<TrackBulkUnmuteModal />
|
138
155
|
<TrackNotifications />
|
139
156
|
<PeerNotifications />
|
140
157
|
<ReconnectNotifications />
|
141
158
|
<AutoplayBlockedModal />
|
142
159
|
<PermissionErrorModal />
|
143
|
-
<MessageNotifications />
|
144
160
|
<InitErrorModal notification={notification} />
|
145
161
|
</>
|
146
162
|
);
|
@@ -1,5 +1,11 @@
|
|
1
1
|
import { useEffect } from 'react';
|
2
|
-
import {
|
2
|
+
import {
|
3
|
+
HMSNotificationTypes,
|
4
|
+
HMSRoomState,
|
5
|
+
selectRoomState,
|
6
|
+
useHMSNotifications,
|
7
|
+
useHMSStore,
|
8
|
+
} from '@100mslive/react-sdk';
|
3
9
|
import { ToastBatcher } from '../Toast/ToastBatcher';
|
4
10
|
import { useSubscribedNotifications } from '../AppData/useUISettings';
|
5
11
|
import { isInternalRole } from '../../common/utils';
|
@@ -15,10 +21,15 @@ export const PeerNotifications = () => {
|
|
15
21
|
const notification = useHMSNotifications(notificationTypes);
|
16
22
|
const isPeerJoinSubscribed = useSubscribedNotifications(SUBSCRIBED_NOTIFICATIONS.PEER_JOINED);
|
17
23
|
const isPeerLeftSubscribed = useSubscribedNotifications(SUBSCRIBED_NOTIFICATIONS.PEER_LEFT);
|
24
|
+
const roomState = useHMSStore(selectRoomState);
|
18
25
|
useEffect(() => {
|
26
|
+
if (roomState !== HMSRoomState.Connected) {
|
27
|
+
return;
|
28
|
+
}
|
19
29
|
if (!notification || (notification?.data?.roleName && isInternalRole(notification.data.roleName))) {
|
20
30
|
return;
|
21
31
|
}
|
32
|
+
|
22
33
|
console.debug(`[${notification.type}]`, notification);
|
23
34
|
switch (notification.type) {
|
24
35
|
case HMSNotificationTypes.PEER_LIST:
|
@@ -39,8 +50,9 @@ export const PeerNotifications = () => {
|
|
39
50
|
default:
|
40
51
|
return;
|
41
52
|
}
|
53
|
+
|
42
54
|
ToastBatcher.showToast({ notification });
|
43
|
-
}, [notification, isPeerJoinSubscribed, isPeerLeftSubscribed]);
|
55
|
+
}, [notification, isPeerJoinSubscribed, isPeerLeftSubscribed, roomState]);
|
44
56
|
|
45
57
|
return null;
|
46
58
|
};
|
@@ -2,8 +2,8 @@ import React, { useEffect, useState } from 'react';
|
|
2
2
|
import { useMedia } from 'react-use';
|
3
3
|
import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
|
4
4
|
import { Button, config as cssConfig, Dialog, Flex, Text } from '../../../';
|
5
|
-
import androidPermissionAlert from '
|
6
|
-
import iosPermissions from '
|
5
|
+
import androidPermissionAlert from '../../images/android-perm-1.png';
|
6
|
+
import iosPermissions from '../../images/ios-perm-0.png';
|
7
7
|
import { isAndroid, isIOS } from '../../common/constants';
|
8
8
|
|
9
9
|
export function PermissionErrorModal() {
|
@@ -47,11 +47,17 @@ export function PermissionErrorModal() {
|
|
47
47
|
borderBottom: '1px solid $border_default',
|
48
48
|
}}
|
49
49
|
>
|
50
|
-
{isMobile && isIOS ?
|
50
|
+
{isMobile && isIOS ? (
|
51
|
+
<img style={{ maxWidth: '100%', maxHeight: '100%' }} src={iosPermissions} alt="iOS Permission flow" />
|
52
|
+
) : null}
|
51
53
|
|
52
54
|
{/* Images for android */}
|
53
55
|
{isMobile && isAndroid ? (
|
54
|
-
<img
|
56
|
+
<img
|
57
|
+
src={androidPermissionAlert}
|
58
|
+
style={{ maxWidth: '100%', maxHeight: '100%' }}
|
59
|
+
alt="Android Permission flow "
|
60
|
+
/>
|
55
61
|
) : null}
|
56
62
|
|
57
63
|
<Text variant="h6">We can't access your {deviceType}</Text>
|
@@ -11,7 +11,6 @@ const notificationTypes = [
|
|
11
11
|
];
|
12
12
|
let notificationId = null;
|
13
13
|
|
14
|
-
const isQA = process.env.REACT_APP_ENV === 'qa';
|
15
14
|
export const ReconnectNotifications = () => {
|
16
15
|
const notification = useHMSNotifications(notificationTypes);
|
17
16
|
const [open, setOpen] = useState(false);
|
@@ -22,18 +21,13 @@ export const ReconnectNotifications = () => {
|
|
22
21
|
notificationId = ToastManager.replaceToast(notificationId, ToastConfig.RECONNECTED.single());
|
23
22
|
setOpen(false);
|
24
23
|
} else if (notification?.type === HMSNotificationTypes.RECONNECTING) {
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
notificationId = ToastManager.replaceToast(
|
30
|
-
notificationId,
|
31
|
-
ToastConfig.RECONNECTING.single(notification.data.message),
|
32
|
-
);
|
33
|
-
}
|
24
|
+
notificationId = ToastManager.replaceToast(
|
25
|
+
notificationId,
|
26
|
+
ToastConfig.RECONNECTING.single(notification.data.message),
|
27
|
+
);
|
34
28
|
}
|
35
29
|
}, [notification]);
|
36
|
-
if (!open
|
30
|
+
if (!open) return null;
|
37
31
|
return (
|
38
32
|
<Dialog.Root open={open} modal={true}>
|
39
33
|
<Dialog.Portal container={document.getElementById('conferencing')}>
|
@@ -1,31 +1,20 @@
|
|
1
1
|
import React, { useCallback, useEffect, useState } from 'react';
|
2
|
-
import {
|
3
|
-
selectLocalPeerRoleName,
|
4
|
-
selectPeers,
|
5
|
-
selectTracksMap,
|
6
|
-
useHMSActions,
|
7
|
-
useHMSStore,
|
8
|
-
useHMSVanillaStore,
|
9
|
-
} from '@100mslive/react-sdk';
|
2
|
+
import { selectPeers, selectTracksMap, useHMSActions, useHMSStore, useHMSVanillaStore } from '@100mslive/react-sdk';
|
10
3
|
import { PipIcon } from '@100mslive/react-icons';
|
11
4
|
import { Flex, Tooltip } from '../../../';
|
12
5
|
import IconButton from '../../IconButton';
|
13
6
|
import { PictureInPicture } from './PIPManager';
|
14
7
|
import { MediaSession } from './SetupMediaSession';
|
15
8
|
import { usePinnedTrack } from '../AppData/useUISettings';
|
16
|
-
import { useIsFeatureEnabled } from '../hooks/useFeatures';
|
17
|
-
import { DEFAULT_HLS_VIEWER_ROLE, FEATURE_LIST } from '../../common/constants';
|
18
9
|
|
19
10
|
/**
|
20
11
|
* shows a button which when clicked shows some videos in PIP, clicking
|
21
12
|
* again turns it off.
|
22
13
|
*/
|
23
14
|
const PIPComponent = ({ content = null }) => {
|
24
|
-
const localPeerRole = useHMSStore(selectLocalPeerRoleName);
|
25
15
|
const [isPipOn, setIsPipOn] = useState(PictureInPicture.isOn());
|
26
16
|
const hmsActions = useHMSActions();
|
27
17
|
const store = useHMSVanillaStore();
|
28
|
-
const isFeatureEnabled = useIsFeatureEnabled(FEATURE_LIST.PICTURE_IN_PICTURE);
|
29
18
|
|
30
19
|
const onPipToggle = useCallback(() => {
|
31
20
|
if (!isPipOn) {
|
@@ -36,7 +25,7 @@ const PIPComponent = ({ content = null }) => {
|
|
36
25
|
}
|
37
26
|
}, [hmsActions, isPipOn, store]);
|
38
27
|
|
39
|
-
if (!PictureInPicture.isSupported()
|
28
|
+
if (!PictureInPicture.isSupported()) {
|
40
29
|
return null;
|
41
30
|
}
|
42
31
|
return (
|
@@ -66,8 +55,8 @@ export const ActivatedPIP = () => {
|
|
66
55
|
const pinnedTrack = usePinnedTrack();
|
67
56
|
|
68
57
|
useEffect(() => {
|
69
|
-
|
70
|
-
if (!
|
58
|
+
function updatePIP() {
|
59
|
+
if (!PictureInPicture.isOn()) {
|
71
60
|
return;
|
72
61
|
}
|
73
62
|
let pipPeers = storePeers;
|
@@ -77,7 +66,9 @@ export const ActivatedPIP = () => {
|
|
77
66
|
PictureInPicture.updatePeersAndTracks(pipPeers, tracksMap).catch(err => {
|
78
67
|
console.error('error in updating pip', err);
|
79
68
|
});
|
80
|
-
}
|
69
|
+
}
|
70
|
+
PictureInPicture.listenToStateChange(updatePIP);
|
71
|
+
updatePIP();
|
81
72
|
}, [storePeers, tracksMap, pinnedTrack]);
|
82
73
|
|
83
74
|
return <></>;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import { ChevronLeftIcon, ChevronRightIcon } from '@100mslive/react-icons';
|
3
|
+
import { StyledPagination } from '../../Pagination';
|
4
|
+
|
5
|
+
export const Pagination = ({
|
6
|
+
page,
|
7
|
+
onPageChange,
|
8
|
+
numPages,
|
9
|
+
}: {
|
10
|
+
page: number;
|
11
|
+
onPageChange: (page: number) => void;
|
12
|
+
numPages: number;
|
13
|
+
}) => {
|
14
|
+
const disableLeft = page === 0;
|
15
|
+
const disableRight = page === numPages - 1;
|
16
|
+
const nextPage = (e: React.SyntheticEvent) => {
|
17
|
+
e.stopPropagation();
|
18
|
+
onPageChange(Math.min(page + 1, numPages - 1));
|
19
|
+
};
|
20
|
+
const prevPage = (e: React.SyntheticEvent) => {
|
21
|
+
e.stopPropagation();
|
22
|
+
onPageChange(Math.max(page - 1, 0));
|
23
|
+
};
|
24
|
+
|
25
|
+
useEffect(() => {
|
26
|
+
// currentPageIndex should not exceed pages length
|
27
|
+
if (page >= numPages) {
|
28
|
+
onPageChange(Math.max(0, numPages - 1));
|
29
|
+
}
|
30
|
+
}, [numPages, onPageChange, page]);
|
31
|
+
|
32
|
+
if (numPages <= 1) {
|
33
|
+
return null;
|
34
|
+
}
|
35
|
+
|
36
|
+
return (
|
37
|
+
<StyledPagination.Root css={{ flexShrink: 0 }}>
|
38
|
+
<StyledPagination.Chevron disabled={disableLeft} onClick={prevPage}>
|
39
|
+
<ChevronLeftIcon width={16} height={16} style={{ cursor: disableLeft ? 'not-allowed' : 'pointer' }} />
|
40
|
+
</StyledPagination.Chevron>
|
41
|
+
{numPages <= 5 ? (
|
42
|
+
<StyledPagination.Dots>
|
43
|
+
{[...Array(numPages)].map((_, i) => (
|
44
|
+
<StyledPagination.Dot
|
45
|
+
key={i}
|
46
|
+
active={page === i}
|
47
|
+
onClick={e => {
|
48
|
+
e.stopPropagation();
|
49
|
+
onPageChange(i);
|
50
|
+
}}
|
51
|
+
/>
|
52
|
+
))}
|
53
|
+
</StyledPagination.Dots>
|
54
|
+
) : null}
|
55
|
+
<StyledPagination.Chevron disabled={disableRight} onClick={nextPage}>
|
56
|
+
<ChevronRightIcon width={16} height={16} style={{ cursor: disableRight ? 'not-allowed' : 'pointer' }} />
|
57
|
+
</StyledPagination.Chevron>
|
58
|
+
</StyledPagination.Root>
|
59
|
+
);
|
60
|
+
};
|