@100mslive/roomkit-react 0.1.4-alpha.0 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{HLSView-T267ZHOS.js → HLSView-CTAJQUU4.js} +7 -11
- package/dist/{HLSView-T267ZHOS.js.map → HLSView-CTAJQUU4.js.map} +1 -1
- package/dist/PinnedTrackView-CQKONH4O.js +102 -0
- package/dist/PinnedTrackView-CQKONH4O.js.map +7 -0
- package/dist/Popover/index.d.ts +1 -0
- package/dist/Prebuilt/App.d.ts +25 -0
- package/dist/Prebuilt/index.d.ts +1 -0
- package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +1 -1
- package/dist/Sheet/Sheet.d.ts +3093 -0
- package/dist/Sheet/index.d.ts +1 -0
- package/dist/Theme/ThemeProvider.d.ts +4 -286
- package/dist/Theme/stitches.config.d.ts +1 -1
- package/dist/{VirtualBackground-BCKXNDTD.js → VirtualBackground-GGGBJYVY.js} +31 -7
- package/dist/VirtualBackground-GGGBJYVY.js.map +7 -0
- package/dist/chunk-I2FJWE74.js +827 -0
- package/dist/chunk-I2FJWE74.js.map +7 -0
- package/dist/{chunk-NLZVUXR3.js → chunk-L2SX7GBO.js} +3020 -2189
- package/dist/chunk-L2SX7GBO.js.map +7 -0
- package/dist/chunk-NOKIGB6Y.js +1100 -0
- package/dist/chunk-NOKIGB6Y.js.map +7 -0
- package/dist/chunk-TJNDX446.js +67 -0
- package/dist/chunk-TJNDX446.js.map +7 -0
- package/dist/{chunk-3HMUOAD6.js → conference-OEO7VOJD.js} +3136 -653
- package/dist/conference-OEO7VOJD.js.map +7 -0
- package/dist/index.cjs.js +15733 -15498
- package/dist/index.cjs.js.map +4 -4
- package/dist/index.js +4 -8
- package/dist/meta.cjs.json +3248 -3039
- package/dist/meta.esbuild.json +3398 -3386
- package/dist/utils/animations.d.ts +16 -0
- package/package.json +8 -11
- package/src/Button/Button.tsx +4 -4
- package/src/Dropdown/Dropdown.tsx +2 -2
- package/src/IconButton/IconButton.tsx +4 -2
- package/src/Pagination/StyledPagination.tsx +1 -0
- package/src/Popover/index.tsx +2 -1
- package/src/Prebuilt/{App.jsx → App.tsx} +95 -48
- package/src/Prebuilt/Prebuilt.stories.tsx +22 -8
- package/src/Prebuilt/common/constants.js +1 -2
- package/src/Prebuilt/common/hooks.js +8 -0
- package/src/Prebuilt/common/utils.js +15 -0
- package/src/Prebuilt/components/AppData/AppData.jsx +1 -2
- package/src/Prebuilt/components/AppData/useUISettings.js +0 -5
- package/src/Prebuilt/components/AudioVideoToggle.jsx +69 -26
- package/src/Prebuilt/components/AuthToken.jsx +3 -2
- package/src/Prebuilt/components/Chat/ChatSelector.jsx +1 -1
- package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -1
- package/src/Prebuilt/components/EmojiReaction.jsx +23 -73
- package/src/Prebuilt/components/EndSessionContent.jsx +57 -0
- package/src/Prebuilt/components/EqualProminence.jsx +180 -0
- package/src/Prebuilt/components/ErrorBoundary.jsx +4 -10
- package/src/Prebuilt/components/Footer/EmojiCard.jsx +34 -0
- package/src/Prebuilt/components/Footer/Footer.jsx +73 -0
- package/src/Prebuilt/components/{Header → Footer}/ParticipantList.jsx +5 -5
- package/src/Prebuilt/components/Header/ConferencingHeader.jsx +27 -7
- package/src/Prebuilt/components/Header/HeaderComponents.jsx +16 -14
- package/src/Prebuilt/components/Header/StreamActions.jsx +101 -36
- package/src/Prebuilt/components/Header/StreamingHeader.jsx +1 -1
- package/src/Prebuilt/components/Header/common.jsx +164 -0
- package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +1 -2
- package/src/Prebuilt/components/LeaveCard.jsx +19 -0
- package/src/Prebuilt/components/LeaveRoom.jsx +35 -143
- package/src/Prebuilt/components/LeaveSessionContent.jsx +45 -0
- package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +55 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +96 -0
- package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +31 -54
- package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +48 -73
- package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +5 -221
- package/src/Prebuilt/components/MoreSettings/MuteAllContent.jsx +61 -0
- package/src/Prebuilt/components/MoreSettings/MuteAllModal.jsx +32 -49
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopLeaveRoom.jsx +129 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +219 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebLeaveRoom.jsx +100 -0
- package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +259 -0
- package/src/Prebuilt/components/Notifications/Notifications.jsx +0 -2
- package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +0 -4
- package/src/Prebuilt/components/PIP/PIPComponent.jsx +30 -26
- package/src/Prebuilt/components/PIP/PIPManager.js +13 -0
- package/src/Prebuilt/components/PIP/index.jsx +2 -7
- package/src/Prebuilt/components/Pagination.jsx +4 -4
- package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
- package/src/Prebuilt/components/Preview/PreviewForm.jsx +9 -5
- package/src/Prebuilt/components/Preview/PreviewJoin.jsx +20 -27
- package/src/Prebuilt/components/RaiseHand.jsx +27 -0
- package/src/Prebuilt/components/ScreenShare.jsx +1 -1
- package/src/Prebuilt/components/ScreenshareDisplay.jsx +2 -2
- package/src/Prebuilt/components/ScreenshareTile.jsx +2 -2
- package/src/Prebuilt/components/Settings/DeviceSettings.jsx +2 -1
- package/src/Prebuilt/components/Settings/LayoutSettings.jsx +1 -24
- package/src/Prebuilt/components/Settings/SettingsModal.jsx +152 -17
- package/src/Prebuilt/components/ShareMenuIcon.jsx +1 -0
- package/src/Prebuilt/components/TileMenu/TileMenu.jsx +133 -0
- package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +313 -0
- package/src/Prebuilt/components/VideoList.jsx +5 -33
- package/src/Prebuilt/components/VideoTile.jsx +30 -8
- package/src/Prebuilt/components/conference.jsx +14 -1
- package/src/Prebuilt/components/init/Init.jsx +0 -27
- package/src/Prebuilt/components/init/initUtils.js +0 -23
- package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -1
- package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +1 -1
- package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +19 -8
- package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -0
- package/src/Prebuilt/images/pdf-share.png +0 -0
- package/src/Prebuilt/images/screen-share.png +0 -0
- package/src/Prebuilt/index.ts +1 -0
- package/src/Prebuilt/layouts/EmbedView.jsx +0 -1
- package/src/Prebuilt/layouts/InsetView.jsx +65 -24
- package/src/Prebuilt/layouts/PDFView.jsx +0 -1
- package/src/Prebuilt/layouts/SidePane.jsx +8 -7
- package/src/Prebuilt/layouts/WhiteboardView.jsx +2 -4
- package/src/Prebuilt/layouts/mainView.jsx +22 -31
- package/src/Prebuilt/layouts/screenShareView.jsx +0 -2
- package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +25 -1
- package/src/Prebuilt/plugins/whiteboard/index.js +1 -1
- package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
- package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
- package/src/Sheet/Sheet.mdx +19 -0
- package/src/Sheet/Sheet.stories.tsx +103 -0
- package/src/Sheet/Sheet.tsx +118 -0
- package/src/Sheet/index.ts +1 -0
- package/src/Theme/ThemeProvider.tsx +10 -13
- package/src/Theme/base.config.ts +1 -1
- package/src/Theme/stitches.config.ts +1 -1
- package/src/TileMenu/StyledMenuTile.tsx +2 -2
- package/src/TileMenu/TileMenu.tsx +2 -0
- package/src/VideoTile/StyledVideoTile.tsx +5 -0
- package/src/utils/animations.ts +18 -0
- package/dist/ActiveSpeakerView-AGL73O6U.css +0 -11
- package/dist/ActiveSpeakerView-AGL73O6U.css.map +0 -7
- package/dist/ActiveSpeakerView-UPFD5RXA.js +0 -39
- package/dist/ActiveSpeakerView-UPFD5RXA.js.map +0 -7
- package/dist/HLSView-64OG755F.css +0 -11
- package/dist/HLSView-64OG755F.css.map +0 -7
- package/dist/PinnedTrackView-O4FHHHOV.js +0 -70
- package/dist/PinnedTrackView-O4FHHHOV.js.map +0 -7
- package/dist/PinnedTrackView-YWAZ2342.css +0 -11
- package/dist/PinnedTrackView-YWAZ2342.css.map +0 -7
- package/dist/VirtualBackground-BCKXNDTD.js.map +0 -7
- package/dist/chunk-3HMUOAD6.js.map +0 -7
- package/dist/chunk-6GXDYWD5.js +0 -243
- package/dist/chunk-6GXDYWD5.js.map +0 -7
- package/dist/chunk-NLZVUXR3.js.map +0 -7
- package/dist/chunk-ORPC2GYB.js +0 -58
- package/dist/chunk-ORPC2GYB.js.map +0 -7
- package/dist/chunk-YE4RPJYG.js +0 -811
- package/dist/chunk-YE4RPJYG.js.map +0 -7
- package/dist/conference-7KHWJZLG.css +0 -11
- package/dist/conference-7KHWJZLG.css.map +0 -7
- package/dist/conference-ETISNCLN.js +0 -3697
- package/dist/conference-ETISNCLN.js.map +0 -7
- package/dist/index.cjs.css +0 -11
- package/dist/index.cjs.css.map +0 -7
- package/dist/index.css +0 -11
- package/dist/index.css.map +0 -7
- package/dist/transcription-JJQ4UAIK.js +0 -356
- package/dist/transcription-JJQ4UAIK.js.map +0 -7
- package/src/Prebuilt/common/useSortedPeers.js +0 -28
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +0 -96
- package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +0 -46
- package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +0 -101
- package/src/Prebuilt/components/Footer/StreamingFooter.jsx +0 -71
- package/src/Prebuilt/components/Footer.jsx +0 -8
- package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +0 -67
- package/src/Prebuilt/components/TileMenu.jsx +0 -268
- package/src/Prebuilt/index.d.ts +0 -20
- package/src/Prebuilt/index.js +0 -2
@@ -0,0 +1,219 @@
|
|
1
|
+
import React, { Fragment, useState } from 'react';
|
2
|
+
import { HMSHLSPlayer } from '@100mslive/hls-player';
|
3
|
+
import {
|
4
|
+
selectAppData,
|
5
|
+
selectLocalPeerID,
|
6
|
+
selectLocalPeerRoleName,
|
7
|
+
useHMSActions,
|
8
|
+
useHMSStore,
|
9
|
+
} from '@100mslive/react-sdk';
|
10
|
+
import { BrbIcon, CheckIcon, DragHandleIcon, HandIcon, InfoIcon, PipIcon, SettingsIcon } from '@100mslive/react-icons';
|
11
|
+
import { Checkbox, Dropdown, Flex, Text, Tooltip } from '../../../../';
|
12
|
+
import IconButton from '../../../IconButton';
|
13
|
+
import { PIP } from '../../PIP';
|
14
|
+
import { RoleChangeModal } from '../../RoleChangeModal';
|
15
|
+
import SettingsModal from '../../Settings/SettingsModal';
|
16
|
+
import StartRecording from '../../Settings/StartRecording';
|
17
|
+
import { StatsForNerds } from '../../StatsForNerds';
|
18
|
+
import { BulkRoleChangeModal } from '.././BulkRoleChangeModal';
|
19
|
+
import { FullScreenItem } from '.././FullScreenItem';
|
20
|
+
import { MuteAllModal } from '.././MuteAllModal';
|
21
|
+
import { useHLSViewerRole } from '../../AppData/useUISettings';
|
22
|
+
import { useDropdownList } from '../../hooks/useDropdownList';
|
23
|
+
import { useIsFeatureEnabled } from '../../hooks/useFeatures';
|
24
|
+
import { useMyMetadata } from '../../hooks/useMetadata';
|
25
|
+
import { useShowStreamingUI } from '../../../common/hooks';
|
26
|
+
import { FeatureFlags } from '../../../services/FeatureFlags';
|
27
|
+
import { APP_DATA, FEATURE_LIST, isMacOS } from '../../../common/constants';
|
28
|
+
|
29
|
+
const MODALS = {
|
30
|
+
CHANGE_NAME: 'changeName',
|
31
|
+
SELF_ROLE_CHANGE: 'selfRoleChange',
|
32
|
+
MORE_SETTINGS: 'moreSettings',
|
33
|
+
START_RECORDING: 'startRecording',
|
34
|
+
DEVICE_SETTINGS: 'deviceSettings',
|
35
|
+
STATS_FOR_NERDS: 'statsForNerds',
|
36
|
+
BULK_ROLE_CHANGE: 'bulkRoleChange',
|
37
|
+
MUTE_ALL: 'muteAll',
|
38
|
+
EMBED_URL: 'embedUrl',
|
39
|
+
};
|
40
|
+
|
41
|
+
export const DesktopOptions = () => {
|
42
|
+
const localPeerId = useHMSStore(selectLocalPeerID);
|
43
|
+
const localPeerRole = useHMSStore(selectLocalPeerRoleName);
|
44
|
+
const hmsActions = useHMSActions();
|
45
|
+
const enablHlsStats = useHMSStore(selectAppData(APP_DATA.hlsStats));
|
46
|
+
const isSFNEnabled = useIsFeatureEnabled(FEATURE_LIST.STARTS_FOR_NERDS);
|
47
|
+
const [openModals, setOpenModals] = useState(new Set());
|
48
|
+
const { isHandRaised, isBRBOn, toggleHandRaise, toggleBRB } = useMyMetadata();
|
49
|
+
const isHandRaiseEnabled = useIsFeatureEnabled(FEATURE_LIST.HAND_RAISE);
|
50
|
+
const isBRBEnabled = useIsFeatureEnabled(FEATURE_LIST.BRB);
|
51
|
+
const showStreamingUI = useShowStreamingUI();
|
52
|
+
const hlsViewerRole = useHLSViewerRole();
|
53
|
+
const isHlsViewer = hlsViewerRole === localPeerRole;
|
54
|
+
const isPIPEnabled = useIsFeatureEnabled(FEATURE_LIST.PICTURE_IN_PICTURE);
|
55
|
+
|
56
|
+
useDropdownList({ open: openModals.size > 0, name: 'MoreSettings' });
|
57
|
+
|
58
|
+
const updateState = (modalName, value) => {
|
59
|
+
setOpenModals(modals => {
|
60
|
+
const copy = new Set(modals);
|
61
|
+
if (value) {
|
62
|
+
// avoiding extra set state trigger which removes currently open dialog by clearing set.
|
63
|
+
copy.clear();
|
64
|
+
copy.add(modalName);
|
65
|
+
} else {
|
66
|
+
copy.delete(modalName);
|
67
|
+
}
|
68
|
+
return copy;
|
69
|
+
});
|
70
|
+
};
|
71
|
+
|
72
|
+
return (
|
73
|
+
<Fragment>
|
74
|
+
<Dropdown.Root
|
75
|
+
open={openModals.has(MODALS.MORE_SETTINGS)}
|
76
|
+
onOpenChange={value => updateState(MODALS.MORE_SETTINGS, value)}
|
77
|
+
modal={false}
|
78
|
+
>
|
79
|
+
<Dropdown.Trigger asChild data-testid="more_settings_btn">
|
80
|
+
<IconButton>
|
81
|
+
<Tooltip title="More options">
|
82
|
+
<DragHandleIcon />
|
83
|
+
</Tooltip>
|
84
|
+
</IconButton>
|
85
|
+
</Dropdown.Trigger>
|
86
|
+
|
87
|
+
<Dropdown.Content
|
88
|
+
sideOffset={5}
|
89
|
+
align="end"
|
90
|
+
css={{
|
91
|
+
py: '$0',
|
92
|
+
maxHeight: 'unset',
|
93
|
+
'@md': { w: '$64' },
|
94
|
+
"div[role='separator']:first-child": {
|
95
|
+
display: 'none',
|
96
|
+
},
|
97
|
+
}}
|
98
|
+
>
|
99
|
+
{isHandRaiseEnabled && !showStreamingUI ? (
|
100
|
+
<Dropdown.Item onClick={toggleHandRaise} data-testid="raise_hand_btn">
|
101
|
+
<HandIcon />
|
102
|
+
<Text variant="sm" css={{ ml: '$4', color: '$on_surface_high' }}>
|
103
|
+
Raise Hand
|
104
|
+
</Text>
|
105
|
+
<Flex justify="end" css={{ color: '$on_surface_high', flexGrow: '1' }}>
|
106
|
+
{isHandRaised ? <CheckIcon /> : null}
|
107
|
+
</Flex>
|
108
|
+
</Dropdown.Item>
|
109
|
+
) : null}
|
110
|
+
|
111
|
+
{isBRBEnabled && !showStreamingUI ? (
|
112
|
+
<Dropdown.Item onClick={toggleBRB} data-testid="brb_btn">
|
113
|
+
<BrbIcon />
|
114
|
+
<Text variant="sm" css={{ ml: '$4', color: '$on_surface_high' }}>
|
115
|
+
Be Right Back
|
116
|
+
</Text>
|
117
|
+
<Flex justify="end" css={{ color: '$on_surface_high', flexGrow: '1' }}>
|
118
|
+
{isBRBOn ? <CheckIcon /> : null}
|
119
|
+
</Flex>
|
120
|
+
</Dropdown.Item>
|
121
|
+
) : null}
|
122
|
+
|
123
|
+
{(isBRBEnabled || isHandRaiseEnabled) && !showStreamingUI ? (
|
124
|
+
<Dropdown.ItemSeparator css={{ mx: '0' }} />
|
125
|
+
) : null}
|
126
|
+
|
127
|
+
{isPIPEnabled && !isHlsViewer ? (
|
128
|
+
<Dropdown.Item>
|
129
|
+
<PIP
|
130
|
+
content={
|
131
|
+
<Flex css={{ w: '100%' }}>
|
132
|
+
<PipIcon />
|
133
|
+
<Text variant="sm" css={{ ml: '$4' }}>
|
134
|
+
Picture in picture mode
|
135
|
+
</Text>
|
136
|
+
</Flex>
|
137
|
+
}
|
138
|
+
/>
|
139
|
+
</Dropdown.Item>
|
140
|
+
) : null}
|
141
|
+
|
142
|
+
<FullScreenItem />
|
143
|
+
{/* {isAllowedToPublish.screen && isEmbedEnabled && (
|
144
|
+
<EmbedUrl setShowOpenUrl={() => updateState(MODALS.EMBED_URL, true)} />
|
145
|
+
)} */}
|
146
|
+
|
147
|
+
<Dropdown.ItemSeparator css={{ mx: 0 }} />
|
148
|
+
|
149
|
+
<Dropdown.Item onClick={() => updateState(MODALS.DEVICE_SETTINGS, true)} data-testid="device_settings_btn">
|
150
|
+
<SettingsIcon />
|
151
|
+
<Text variant="sm" css={{ ml: '$4' }}>
|
152
|
+
Settings
|
153
|
+
</Text>
|
154
|
+
</Dropdown.Item>
|
155
|
+
|
156
|
+
{FeatureFlags.enableStatsForNerds &&
|
157
|
+
isSFNEnabled &&
|
158
|
+
(localPeerRole === 'hls-viewer' ? (
|
159
|
+
HMSHLSPlayer.isSupported() ? (
|
160
|
+
<Dropdown.Item
|
161
|
+
onClick={() => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats)}
|
162
|
+
data-testid="hls_stats"
|
163
|
+
>
|
164
|
+
<Checkbox.Root
|
165
|
+
css={{ margin: '$2' }}
|
166
|
+
checked={enablHlsStats}
|
167
|
+
onCheckedChange={() => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats)}
|
168
|
+
>
|
169
|
+
<Checkbox.Indicator>
|
170
|
+
<CheckIcon width={16} height={16} />
|
171
|
+
</Checkbox.Indicator>
|
172
|
+
</Checkbox.Root>
|
173
|
+
<Flex justify="between" css={{ width: '100%' }}>
|
174
|
+
<Text variant="sm" css={{ ml: '$4' }}>
|
175
|
+
Show HLS Stats
|
176
|
+
</Text>
|
177
|
+
|
178
|
+
<Text variant="sm" css={{ ml: '$4' }}>
|
179
|
+
{`${isMacOS ? '⌘' : 'ctrl'} + ]`}
|
180
|
+
</Text>
|
181
|
+
</Flex>
|
182
|
+
</Dropdown.Item>
|
183
|
+
) : null
|
184
|
+
) : (
|
185
|
+
<Dropdown.Item
|
186
|
+
onClick={() => updateState(MODALS.STATS_FOR_NERDS, true)}
|
187
|
+
data-testid="stats_for_nreds_btn"
|
188
|
+
>
|
189
|
+
<InfoIcon />
|
190
|
+
<Text variant="sm" css={{ ml: '$4' }}>
|
191
|
+
Stats for Nerds
|
192
|
+
</Text>
|
193
|
+
</Dropdown.Item>
|
194
|
+
))}
|
195
|
+
</Dropdown.Content>
|
196
|
+
</Dropdown.Root>
|
197
|
+
{openModals.has(MODALS.BULK_ROLE_CHANGE) && (
|
198
|
+
<BulkRoleChangeModal onOpenChange={value => updateState(MODALS.BULK_ROLE_CHANGE, value)} />
|
199
|
+
)}
|
200
|
+
{openModals.has(MODALS.MUTE_ALL) && <MuteAllModal onOpenChange={value => updateState(MODALS.MUTE_ALL, value)} />}
|
201
|
+
|
202
|
+
{openModals.has(MODALS.START_RECORDING) && (
|
203
|
+
<StartRecording open onOpenChange={value => updateState(MODALS.START_RECORDING, value)} />
|
204
|
+
)}
|
205
|
+
{openModals.has(MODALS.DEVICE_SETTINGS) && (
|
206
|
+
<SettingsModal open onOpenChange={value => updateState(MODALS.DEVICE_SETTINGS, value)} />
|
207
|
+
)}
|
208
|
+
{FeatureFlags.enableStatsForNerds && openModals.has(MODALS.STATS_FOR_NERDS) && (
|
209
|
+
<StatsForNerds open onOpenChange={value => updateState(MODALS.STATS_FOR_NERDS, value)} />
|
210
|
+
)}
|
211
|
+
{openModals.has(MODALS.SELF_ROLE_CHANGE) && (
|
212
|
+
<RoleChangeModal peerId={localPeerId} onOpenChange={value => updateState(MODALS.SELF_ROLE_CHANGE, value)} />
|
213
|
+
)}
|
214
|
+
{/* {openModals.has(MODALS.EMBED_URL) && (
|
215
|
+
<EmbedUrlModal onOpenChange={value => updateState(MODALS.EMBED_URL, value)} />
|
216
|
+
)} */}
|
217
|
+
</Fragment>
|
218
|
+
);
|
219
|
+
};
|
@@ -0,0 +1,100 @@
|
|
1
|
+
import React, { Fragment, useState } from 'react';
|
2
|
+
import { selectIsConnectedToRoom, selectPermissions, useHMSStore, useRecordingStreaming } from '@100mslive/react-sdk';
|
3
|
+
import { ExitIcon, StopIcon } from '@100mslive/react-icons';
|
4
|
+
import { Box } from '../../../../Layout';
|
5
|
+
import { Sheet } from '../../../../Sheet';
|
6
|
+
import { Tooltip } from '../../../../Tooltip';
|
7
|
+
import { EndSessionContent } from '../../EndSessionContent';
|
8
|
+
import { LeaveCard } from '../../LeaveCard';
|
9
|
+
import { useDropdownList } from '../../hooks/useDropdownList';
|
10
|
+
import { useShowStreamingUI } from '../../../common/hooks';
|
11
|
+
|
12
|
+
export const MwebLeaveRoom = ({ leaveIconButton: LeaveIconButton, leaveRoom, stopStream }) => {
|
13
|
+
const [open, setOpen] = useState(false);
|
14
|
+
const [showEndStreamAlert, setShowEndStreamAlert] = useState(false);
|
15
|
+
const isConnected = useHMSStore(selectIsConnectedToRoom);
|
16
|
+
const permissions = useHMSStore(selectPermissions);
|
17
|
+
const { isStreamingOn } = useRecordingStreaming();
|
18
|
+
|
19
|
+
const showStreamingUI = useShowStreamingUI();
|
20
|
+
|
21
|
+
const showStream = showStreamingUI && isStreamingOn;
|
22
|
+
useDropdownList({ open, name: 'LeaveRoom' });
|
23
|
+
|
24
|
+
if (!permissions || !isConnected) {
|
25
|
+
return null;
|
26
|
+
}
|
27
|
+
|
28
|
+
return (
|
29
|
+
<Fragment>
|
30
|
+
{permissions?.hlsStreaming ? (
|
31
|
+
<Sheet.Root open={open} onOpenChange={setOpen}>
|
32
|
+
<Sheet.Trigger asChild>
|
33
|
+
<LeaveIconButton
|
34
|
+
variant="danger"
|
35
|
+
key="LeaveRoom"
|
36
|
+
data-testid="leave_room_btn"
|
37
|
+
css={{
|
38
|
+
borderTopRightRadius: '$1',
|
39
|
+
borderBottomRightRadius: '$1',
|
40
|
+
}}
|
41
|
+
>
|
42
|
+
<Tooltip title="Leave Room">
|
43
|
+
<Box>
|
44
|
+
<ExitIcon style={{ transform: 'rotate(180deg)' }} />
|
45
|
+
</Box>
|
46
|
+
</Tooltip>
|
47
|
+
</LeaveIconButton>
|
48
|
+
</Sheet.Trigger>
|
49
|
+
<Sheet.Content>
|
50
|
+
<LeaveCard
|
51
|
+
title={showStream ? 'Leave Stream' : 'Leave Session'}
|
52
|
+
subtitle={`Others will continue after you leave. You can join the ${
|
53
|
+
showStream ? 'stream' : 'session'
|
54
|
+
} again.`}
|
55
|
+
bg="$surface_default"
|
56
|
+
titleColor="$on_surface_high"
|
57
|
+
subtitleColor="$on_surface_low"
|
58
|
+
icon={<ExitIcon height={24} width={24} style={{ transform: 'rotate(180deg)' }} />}
|
59
|
+
onClick={leaveRoom}
|
60
|
+
css={{ pt: 0, mt: '$10' }}
|
61
|
+
/>
|
62
|
+
{isStreamingOn && permissions?.hlsStreaming ? (
|
63
|
+
<LeaveCard
|
64
|
+
title={showStream ? 'End Stream' : 'End Session'}
|
65
|
+
subtitle={`The will end the ${
|
66
|
+
showStream ? 'stream' : 'session'
|
67
|
+
} for everyone. You can't undo this action.`}
|
68
|
+
bg="$alert_error_dim"
|
69
|
+
titleColor="$alert_error_brighter"
|
70
|
+
subtitleColor="$alert_error_bright"
|
71
|
+
icon={<StopIcon height={24} width={24} />}
|
72
|
+
onClick={() => {
|
73
|
+
setOpen(false);
|
74
|
+
setShowEndStreamAlert(true);
|
75
|
+
}}
|
76
|
+
/>
|
77
|
+
) : null}
|
78
|
+
</Sheet.Content>
|
79
|
+
</Sheet.Root>
|
80
|
+
) : (
|
81
|
+
<LeaveIconButton variant="danger" key="LeaveRoom" data-testid="leave_room_btn" onClick={leaveRoom}>
|
82
|
+
<Tooltip title="Leave Room">
|
83
|
+
<Box>
|
84
|
+
<ExitIcon style={{ transform: 'rotate(180deg)' }} />
|
85
|
+
</Box>
|
86
|
+
</Tooltip>
|
87
|
+
</LeaveIconButton>
|
88
|
+
)}
|
89
|
+
<Sheet.Root open={showEndStreamAlert} onOpenChange={setShowEndStreamAlert}>
|
90
|
+
<Sheet.Content css={{ bg: '$surface_dim', p: '$10', pb: '$12' }}>
|
91
|
+
<EndSessionContent
|
92
|
+
setShowEndStreamAlert={setShowEndStreamAlert}
|
93
|
+
stopStream={stopStream}
|
94
|
+
leaveRoom={leaveRoom}
|
95
|
+
/>
|
96
|
+
</Sheet.Content>
|
97
|
+
</Sheet.Root>
|
98
|
+
</Fragment>
|
99
|
+
);
|
100
|
+
};
|
@@ -0,0 +1,259 @@
|
|
1
|
+
import React, { Suspense, useRef, useState } from 'react';
|
2
|
+
import { useClickAway } from 'react-use';
|
3
|
+
import {
|
4
|
+
selectIsConnectedToRoom,
|
5
|
+
selectIsLocalVideoEnabled,
|
6
|
+
selectPeerCount,
|
7
|
+
selectPermissions,
|
8
|
+
useHMSActions,
|
9
|
+
useHMSStore,
|
10
|
+
useRecordingStreaming,
|
11
|
+
} from '@100mslive/react-sdk';
|
12
|
+
import { CrossIcon, DragHandleIcon, EmojiIcon, PeopleIcon, RecordIcon, SettingsIcon } from '@100mslive/react-icons';
|
13
|
+
import { Box, Loading, Tooltip } from '../../../../';
|
14
|
+
import { Sheet } from '../../../../Sheet';
|
15
|
+
import IconButton from '../../../IconButton';
|
16
|
+
import { EmojiCard } from '../../Footer/EmojiCard';
|
17
|
+
import { StopRecordingInSheet } from '../../Header/StreamActions';
|
18
|
+
import SettingsModal from '../../Settings/SettingsModal';
|
19
|
+
import { ToastManager } from '../../Toast/ToastManager';
|
20
|
+
import { ActionTile } from '.././ActionTile';
|
21
|
+
import { ChangeNameModal } from '.././ChangeNameModal';
|
22
|
+
import { MuteAllModal } from '.././MuteAllModal';
|
23
|
+
import { useSidepaneToggle } from '../../AppData/useSidepane';
|
24
|
+
import { useDropdownList } from '../../hooks/useDropdownList';
|
25
|
+
import { getFormattedCount } from '../../../common/utils';
|
26
|
+
import { SIDE_PANE_OPTIONS } from '../../../common/constants';
|
27
|
+
|
28
|
+
const VirtualBackground = React.lazy(() => import('../../../plugins/VirtualBackground/VirtualBackground'));
|
29
|
+
|
30
|
+
const MODALS = {
|
31
|
+
CHANGE_NAME: 'changeName',
|
32
|
+
SELF_ROLE_CHANGE: 'selfRoleChange',
|
33
|
+
MORE_SETTINGS: 'moreSettings',
|
34
|
+
START_RECORDING: 'startRecording',
|
35
|
+
DEVICE_SETTINGS: 'deviceSettings',
|
36
|
+
STATS_FOR_NERDS: 'statsForNerds',
|
37
|
+
BULK_ROLE_CHANGE: 'bulkRoleChange',
|
38
|
+
MUTE_ALL: 'muteAll',
|
39
|
+
EMBED_URL: 'embedUrl',
|
40
|
+
};
|
41
|
+
|
42
|
+
export const MwebOptions = () => {
|
43
|
+
const hmsActions = useHMSActions();
|
44
|
+
const permissions = useHMSStore(selectPermissions);
|
45
|
+
const isConnected = useHMSStore(selectIsConnectedToRoom);
|
46
|
+
const { isBrowserRecordingOn, isStreamingOn, isHLSRunning } = useRecordingStreaming();
|
47
|
+
|
48
|
+
const [openModals, setOpenModals] = useState(new Set());
|
49
|
+
|
50
|
+
const [openOptionsSheet, setOpenOptionsSheet] = useState(false);
|
51
|
+
const [openSettingsSheet, setOpenSettingsSheet] = useState(false);
|
52
|
+
const [showEmojiCard, setShowEmojiCard] = useState(false);
|
53
|
+
const [showRecordingOn, setShowRecordingOn] = useState(false);
|
54
|
+
const [isRecordingLoading, setIsRecordingLoading] = useState(false);
|
55
|
+
const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
|
56
|
+
const peerCount = useHMSStore(selectPeerCount);
|
57
|
+
const emojiCardRef = useRef(null);
|
58
|
+
const isVideoOn = useHMSStore(selectIsLocalVideoEnabled);
|
59
|
+
|
60
|
+
useDropdownList({ open: openModals.size > 0, name: 'MoreSettings' });
|
61
|
+
|
62
|
+
const updateState = (modalName, value) => {
|
63
|
+
setOpenModals(modals => {
|
64
|
+
const copy = new Set(modals);
|
65
|
+
if (value) {
|
66
|
+
copy.add(modalName);
|
67
|
+
} else {
|
68
|
+
copy.delete(modalName);
|
69
|
+
}
|
70
|
+
return copy;
|
71
|
+
});
|
72
|
+
};
|
73
|
+
|
74
|
+
useClickAway(emojiCardRef, () => setShowEmojiCard(false));
|
75
|
+
|
76
|
+
return (
|
77
|
+
<>
|
78
|
+
<Sheet.Root open={openOptionsSheet} onOpenChange={setOpenOptionsSheet}>
|
79
|
+
<Sheet.Trigger asChild data-testid="more_settings_btn">
|
80
|
+
<IconButton>
|
81
|
+
<Tooltip title="More options">
|
82
|
+
<DragHandleIcon />
|
83
|
+
</Tooltip>
|
84
|
+
</IconButton>
|
85
|
+
</Sheet.Trigger>
|
86
|
+
<Sheet.Content css={{ bg: '$surface_dim', pb: '$14' }}>
|
87
|
+
<Sheet.Title
|
88
|
+
css={{
|
89
|
+
display: 'flex',
|
90
|
+
color: '$on_surface_high',
|
91
|
+
w: '100%',
|
92
|
+
justifyContent: 'space-between',
|
93
|
+
fontSize: '$md',
|
94
|
+
mt: '$8',
|
95
|
+
px: '$10',
|
96
|
+
pb: '$8',
|
97
|
+
borderBottom: '1px solid $border_default',
|
98
|
+
mb: '$8',
|
99
|
+
alignItems: 'center',
|
100
|
+
}}
|
101
|
+
>
|
102
|
+
Options
|
103
|
+
<Sheet.Close>
|
104
|
+
<Box css={{ color: '$on_surface_high' }}>
|
105
|
+
<CrossIcon />
|
106
|
+
</Box>
|
107
|
+
</Sheet.Close>
|
108
|
+
</Sheet.Title>
|
109
|
+
<Box
|
110
|
+
css={{
|
111
|
+
display: 'grid',
|
112
|
+
gridTemplateColumns: '1fr 1fr 1fr',
|
113
|
+
gridTemplateRows: 'auto',
|
114
|
+
gridColumnGap: '$6',
|
115
|
+
gridRowGap: '$8',
|
116
|
+
px: '$9',
|
117
|
+
}}
|
118
|
+
>
|
119
|
+
<ActionTile.Root
|
120
|
+
onClick={() => {
|
121
|
+
toggleParticipants();
|
122
|
+
setOpenOptionsSheet(false);
|
123
|
+
}}
|
124
|
+
>
|
125
|
+
<ActionTile.Count>{getFormattedCount(peerCount)}</ActionTile.Count>
|
126
|
+
<PeopleIcon />
|
127
|
+
<ActionTile.Title>Participants</ActionTile.Title>
|
128
|
+
</ActionTile.Root>
|
129
|
+
|
130
|
+
{isVideoOn ? (
|
131
|
+
<Suspense fallback="">
|
132
|
+
<VirtualBackground asActionTile onVBClick={() => setOpenOptionsSheet(false)} />
|
133
|
+
</Suspense>
|
134
|
+
) : null}
|
135
|
+
|
136
|
+
<ActionTile.Root
|
137
|
+
onClick={() => {
|
138
|
+
setShowEmojiCard(true);
|
139
|
+
setOpenOptionsSheet(false);
|
140
|
+
}}
|
141
|
+
>
|
142
|
+
<EmojiIcon />
|
143
|
+
<ActionTile.Title>Emoji Reactions</ActionTile.Title>
|
144
|
+
</ActionTile.Root>
|
145
|
+
|
146
|
+
<ActionTile.Root
|
147
|
+
onClick={() => {
|
148
|
+
setOpenSettingsSheet(true);
|
149
|
+
setOpenOptionsSheet(false);
|
150
|
+
}}
|
151
|
+
>
|
152
|
+
<SettingsIcon />
|
153
|
+
<ActionTile.Title>Settings</ActionTile.Title>
|
154
|
+
</ActionTile.Root>
|
155
|
+
|
156
|
+
{isConnected && permissions?.browserRecording ? (
|
157
|
+
<ActionTile.Root
|
158
|
+
disabled={isHLSRunning}
|
159
|
+
onClick={async () => {
|
160
|
+
if (isRecordingLoading) {
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
if (isBrowserRecordingOn || isStreamingOn) {
|
164
|
+
setOpenOptionsSheet(false);
|
165
|
+
setShowRecordingOn(true);
|
166
|
+
} else {
|
167
|
+
// start recording
|
168
|
+
setIsRecordingLoading(true);
|
169
|
+
try {
|
170
|
+
await hmsActions.startRTMPOrRecording({
|
171
|
+
record: true,
|
172
|
+
});
|
173
|
+
setOpenOptionsSheet(false);
|
174
|
+
setIsRecordingLoading(false);
|
175
|
+
} catch (error) {
|
176
|
+
if (error.message.includes('stream already running')) {
|
177
|
+
ToastManager.addToast({
|
178
|
+
title: 'Recording already running',
|
179
|
+
variant: 'error',
|
180
|
+
});
|
181
|
+
} else {
|
182
|
+
ToastManager.addToast({
|
183
|
+
title: error.message,
|
184
|
+
variant: 'error',
|
185
|
+
});
|
186
|
+
}
|
187
|
+
setIsRecordingLoading(false);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
if (isHLSRunning) {
|
191
|
+
setOpenOptionsSheet(false);
|
192
|
+
}
|
193
|
+
}}
|
194
|
+
>
|
195
|
+
{isRecordingLoading ? <Loading /> : <RecordIcon />}
|
196
|
+
<ActionTile.Title>
|
197
|
+
{isBrowserRecordingOn
|
198
|
+
? 'Recording On'
|
199
|
+
: isRecordingLoading
|
200
|
+
? 'Starting Recording'
|
201
|
+
: 'Start Recording'}
|
202
|
+
</ActionTile.Title>
|
203
|
+
</ActionTile.Root>
|
204
|
+
) : null}
|
205
|
+
</Box>
|
206
|
+
</Sheet.Content>
|
207
|
+
</Sheet.Root>
|
208
|
+
<SettingsModal open={openSettingsSheet} onOpenChange={setOpenSettingsSheet} />
|
209
|
+
{openModals.has(MODALS.MUTE_ALL) && (
|
210
|
+
<MuteAllModal onOpenChange={value => updateState(MODALS.MUTE_ALL, value)} isMobile />
|
211
|
+
)}
|
212
|
+
{openModals.has(MODALS.CHANGE_NAME) && (
|
213
|
+
<ChangeNameModal
|
214
|
+
onOpenChange={value => updateState(MODALS.CHANGE_NAME, value)}
|
215
|
+
openParentSheet={() => setOpenOptionsSheet(true)}
|
216
|
+
/>
|
217
|
+
)}
|
218
|
+
|
219
|
+
{showEmojiCard && (
|
220
|
+
<Box
|
221
|
+
onClick={() => setShowEmojiCard(false)}
|
222
|
+
ref={emojiCardRef}
|
223
|
+
css={{
|
224
|
+
maxWidth: '100%',
|
225
|
+
w: '100%',
|
226
|
+
position: 'absolute',
|
227
|
+
left: 0,
|
228
|
+
right: 0,
|
229
|
+
bottom: '$18',
|
230
|
+
bg: '$surface_default',
|
231
|
+
zIndex: '10',
|
232
|
+
p: '$8',
|
233
|
+
pb: 0,
|
234
|
+
r: '$1',
|
235
|
+
mx: '$4',
|
236
|
+
}}
|
237
|
+
>
|
238
|
+
<EmojiCard />
|
239
|
+
</Box>
|
240
|
+
)}
|
241
|
+
{showRecordingOn && (
|
242
|
+
<StopRecordingInSheet
|
243
|
+
onClose={() => setShowRecordingOn(false)}
|
244
|
+
onStopRecording={async () => {
|
245
|
+
try {
|
246
|
+
await hmsActions.stopRTMPAndRecording();
|
247
|
+
setShowRecordingOn(false);
|
248
|
+
} catch (error) {
|
249
|
+
ToastManager.addToast({
|
250
|
+
title: error.message,
|
251
|
+
variant: 'error',
|
252
|
+
});
|
253
|
+
}
|
254
|
+
}}
|
255
|
+
/>
|
256
|
+
)}
|
257
|
+
</>
|
258
|
+
);
|
259
|
+
};
|
@@ -1,6 +1,5 @@
|
|
1
1
|
/* eslint-disable no-case-declarations */
|
2
2
|
import React, { useEffect } from 'react';
|
3
|
-
import { logMessage } from 'zipyai';
|
4
3
|
import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
|
5
4
|
import { Button } from '../../../';
|
6
5
|
import { ToastBatcher } from '../Toast/ToastBatcher';
|
@@ -50,7 +49,6 @@ export function Notifications() {
|
|
50
49
|
title: `Error: ${notification.data?.message}`,
|
51
50
|
});
|
52
51
|
} else {
|
53
|
-
logMessage('Disconnected');
|
54
52
|
// show button action when the error is terminal
|
55
53
|
const toastId = ToastManager.addToast({
|
56
54
|
title:
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
2
|
-
import { logMessage } from 'zipyai';
|
3
2
|
import { HMSNotificationTypes, useHMSNotifications } from '@100mslive/react-sdk';
|
4
3
|
import { Dialog, Flex, Loading, Text } from '../../../';
|
5
4
|
import { ToastConfig } from '../Toast/ToastConfig';
|
@@ -18,14 +17,11 @@ export const ReconnectNotifications = () => {
|
|
18
17
|
const [open, setOpen] = useState(false);
|
19
18
|
useEffect(() => {
|
20
19
|
if (notification?.type === HMSNotificationTypes.ERROR && notification?.data?.isTerminal) {
|
21
|
-
logMessage('Error ', notification.data?.description);
|
22
20
|
setOpen(false);
|
23
21
|
} else if (notification?.type === HMSNotificationTypes.RECONNECTED) {
|
24
|
-
logMessage('Reconnected');
|
25
22
|
notificationId = ToastManager.replaceToast(notificationId, ToastConfig.RECONNECTED.single());
|
26
23
|
setOpen(false);
|
27
24
|
} else if (notification?.type === HMSNotificationTypes.RECONNECTING) {
|
28
|
-
logMessage('Reconnecting');
|
29
25
|
if (isQA) {
|
30
26
|
ToastManager.removeToast(notificationId);
|
31
27
|
setOpen(true);
|