@100mslive/roomkit-react 0.1.4-alpha.1 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. package/dist/{HLSView-F2K5VSTS.js → HLSView-P57IRMAR.js} +7 -11
  2. package/dist/{HLSView-F2K5VSTS.js.map → HLSView-P57IRMAR.js.map} +1 -1
  3. package/dist/PinnedTrackView-4FYJEBTB.js +102 -0
  4. package/dist/PinnedTrackView-4FYJEBTB.js.map +7 -0
  5. package/dist/Popover/index.d.ts +1 -0
  6. package/dist/Prebuilt/App.d.ts +25 -0
  7. package/dist/Prebuilt/index.d.ts +1 -0
  8. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +1 -1
  9. package/dist/Sheet/Sheet.d.ts +3093 -0
  10. package/dist/Sheet/index.d.ts +1 -0
  11. package/dist/Theme/ThemeProvider.d.ts +4 -286
  12. package/dist/Theme/stitches.config.d.ts +1 -1
  13. package/dist/{VirtualBackground-S3XEPZ2T.js → VirtualBackground-GGCQJ5JM.js} +31 -7
  14. package/dist/VirtualBackground-GGCQJ5JM.js.map +7 -0
  15. package/dist/chunk-IVTWKQI3.js +827 -0
  16. package/dist/chunk-IVTWKQI3.js.map +7 -0
  17. package/dist/{chunk-42SWPN2C.js → chunk-OSM4QEQG.js} +3020 -2189
  18. package/dist/chunk-OSM4QEQG.js.map +7 -0
  19. package/dist/chunk-P5X32KOD.js +67 -0
  20. package/dist/chunk-P5X32KOD.js.map +7 -0
  21. package/dist/chunk-RVCZPPTL.js +1100 -0
  22. package/dist/chunk-RVCZPPTL.js.map +7 -0
  23. package/dist/{chunk-ESUJK7AT.js → conference-P6I6ESVF.js} +3136 -653
  24. package/dist/conference-P6I6ESVF.js.map +7 -0
  25. package/dist/index.cjs.js +15733 -15498
  26. package/dist/index.cjs.js.map +4 -4
  27. package/dist/index.js +4 -8
  28. package/dist/meta.cjs.json +3355 -3017
  29. package/dist/meta.esbuild.json +3534 -3329
  30. package/dist/utils/animations.d.ts +16 -0
  31. package/package.json +8 -10
  32. package/src/Button/Button.tsx +4 -4
  33. package/src/Dropdown/Dropdown.tsx +2 -2
  34. package/src/IconButton/IconButton.tsx +4 -2
  35. package/src/Pagination/StyledPagination.tsx +1 -0
  36. package/src/Popover/index.tsx +2 -1
  37. package/src/Prebuilt/{App.jsx → App.tsx} +95 -48
  38. package/src/Prebuilt/Prebuilt.stories.tsx +22 -8
  39. package/src/Prebuilt/common/constants.js +1 -2
  40. package/src/Prebuilt/common/hooks.js +8 -0
  41. package/src/Prebuilt/common/utils.js +15 -0
  42. package/src/Prebuilt/components/AppData/AppData.jsx +1 -2
  43. package/src/Prebuilt/components/AppData/useUISettings.js +0 -5
  44. package/src/Prebuilt/components/AudioVideoToggle.jsx +69 -26
  45. package/src/Prebuilt/components/AuthToken.jsx +3 -2
  46. package/src/Prebuilt/components/Chat/ChatSelector.jsx +1 -1
  47. package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -1
  48. package/src/Prebuilt/components/EmojiReaction.jsx +23 -73
  49. package/src/Prebuilt/components/EndSessionContent.jsx +57 -0
  50. package/src/Prebuilt/components/EqualProminence.jsx +180 -0
  51. package/src/Prebuilt/components/ErrorBoundary.jsx +4 -10
  52. package/src/Prebuilt/components/Footer/EmojiCard.jsx +34 -0
  53. package/src/Prebuilt/components/Footer/Footer.jsx +73 -0
  54. package/src/Prebuilt/components/{Header → Footer}/ParticipantList.jsx +5 -5
  55. package/src/Prebuilt/components/Header/ConferencingHeader.jsx +27 -7
  56. package/src/Prebuilt/components/Header/HeaderComponents.jsx +16 -14
  57. package/src/Prebuilt/components/Header/StreamActions.jsx +101 -36
  58. package/src/Prebuilt/components/Header/StreamingHeader.jsx +1 -1
  59. package/src/Prebuilt/components/Header/common.jsx +164 -0
  60. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +1 -2
  61. package/src/Prebuilt/components/LeaveCard.jsx +19 -0
  62. package/src/Prebuilt/components/LeaveRoom.jsx +35 -143
  63. package/src/Prebuilt/components/LeaveSessionContent.jsx +45 -0
  64. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +55 -0
  65. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +96 -0
  66. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +31 -54
  67. package/src/Prebuilt/components/MoreSettings/EmbedUrl.jsx +48 -73
  68. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +5 -221
  69. package/src/Prebuilt/components/MoreSettings/MuteAllContent.jsx +61 -0
  70. package/src/Prebuilt/components/MoreSettings/MuteAllModal.jsx +32 -49
  71. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopLeaveRoom.jsx +129 -0
  72. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +219 -0
  73. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebLeaveRoom.jsx +100 -0
  74. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.jsx +259 -0
  75. package/src/Prebuilt/components/Notifications/Notifications.jsx +0 -2
  76. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +0 -4
  77. package/src/Prebuilt/components/PIP/PIPComponent.jsx +30 -26
  78. package/src/Prebuilt/components/PIP/PIPManager.js +13 -0
  79. package/src/Prebuilt/components/PIP/index.jsx +2 -7
  80. package/src/Prebuilt/components/Pagination.jsx +4 -4
  81. package/src/Prebuilt/components/Preview/PreviewContainer.jsx +5 -13
  82. package/src/Prebuilt/components/Preview/PreviewForm.jsx +9 -5
  83. package/src/Prebuilt/components/Preview/PreviewJoin.jsx +20 -27
  84. package/src/Prebuilt/components/RaiseHand.jsx +27 -0
  85. package/src/Prebuilt/components/ScreenShare.jsx +1 -1
  86. package/src/Prebuilt/components/ScreenshareDisplay.jsx +2 -2
  87. package/src/Prebuilt/components/ScreenshareTile.jsx +2 -2
  88. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +2 -1
  89. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +1 -24
  90. package/src/Prebuilt/components/Settings/SettingsModal.jsx +152 -17
  91. package/src/Prebuilt/components/ShareMenuIcon.jsx +1 -0
  92. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +133 -0
  93. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +313 -0
  94. package/src/Prebuilt/components/VideoList.jsx +5 -33
  95. package/src/Prebuilt/components/VideoTile.jsx +30 -8
  96. package/src/Prebuilt/components/conference.jsx +14 -1
  97. package/src/Prebuilt/components/init/Init.jsx +0 -27
  98. package/src/Prebuilt/components/init/initUtils.js +0 -23
  99. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +2 -1
  100. package/src/Prebuilt/components/pdfAnnotator/pdfInfo.jsx +1 -1
  101. package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +19 -8
  102. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +1 -0
  103. package/src/Prebuilt/images/pdf-share.png +0 -0
  104. package/src/Prebuilt/images/screen-share.png +0 -0
  105. package/src/Prebuilt/index.ts +1 -0
  106. package/src/Prebuilt/layouts/EmbedView.jsx +0 -1
  107. package/src/Prebuilt/layouts/InsetView.jsx +65 -24
  108. package/src/Prebuilt/layouts/PDFView.jsx +0 -1
  109. package/src/Prebuilt/layouts/SidePane.jsx +8 -7
  110. package/src/Prebuilt/layouts/mainView.jsx +22 -31
  111. package/src/Prebuilt/layouts/screenShareView.jsx +0 -2
  112. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +25 -1
  113. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  114. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
  115. package/src/Sheet/Sheet.mdx +19 -0
  116. package/src/Sheet/Sheet.stories.tsx +103 -0
  117. package/src/Sheet/Sheet.tsx +118 -0
  118. package/src/Sheet/index.ts +1 -0
  119. package/src/Theme/ThemeProvider.tsx +10 -13
  120. package/src/Theme/base.config.ts +1 -1
  121. package/src/Theme/stitches.config.ts +1 -1
  122. package/src/TileMenu/StyledMenuTile.tsx +2 -2
  123. package/src/TileMenu/TileMenu.tsx +2 -0
  124. package/src/VideoTile/StyledVideoTile.tsx +5 -0
  125. package/src/utils/animations.ts +18 -0
  126. package/dist/ActiveSpeakerView-V6O4K3BV.js +0 -39
  127. package/dist/ActiveSpeakerView-V6O4K3BV.js.map +0 -7
  128. package/dist/PinnedTrackView-7YQG4QKC.js +0 -70
  129. package/dist/PinnedTrackView-7YQG4QKC.js.map +0 -7
  130. package/dist/VirtualBackground-S3XEPZ2T.js.map +0 -7
  131. package/dist/chunk-42SWPN2C.js.map +0 -7
  132. package/dist/chunk-4NEZLVVH.js +0 -811
  133. package/dist/chunk-4NEZLVVH.js.map +0 -7
  134. package/dist/chunk-4ZBEFSRC.js +0 -58
  135. package/dist/chunk-4ZBEFSRC.js.map +0 -7
  136. package/dist/chunk-ESUJK7AT.js.map +0 -7
  137. package/dist/chunk-R6PDR5WZ.js +0 -243
  138. package/dist/chunk-R6PDR5WZ.js.map +0 -7
  139. package/dist/conference-7QKOMJPP.js +0 -3697
  140. package/dist/conference-7QKOMJPP.js.map +0 -7
  141. package/dist/transcription-RJA4V6PC.js +0 -356
  142. package/dist/transcription-RJA4V6PC.js.map +0 -7
  143. package/src/Prebuilt/common/useSortedPeers.js +0 -28
  144. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +0 -96
  145. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +0 -46
  146. package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +0 -101
  147. package/src/Prebuilt/components/Footer/StreamingFooter.jsx +0 -71
  148. package/src/Prebuilt/components/Footer.jsx +0 -8
  149. package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +0 -67
  150. package/src/Prebuilt/components/TileMenu.jsx +0 -268
  151. package/src/Prebuilt/index.d.ts +0 -20
  152. package/src/Prebuilt/index.js +0 -2
@@ -1,226 +1,10 @@
1
- import React, { Fragment, useState } from 'react';
1
+ import React from 'react';
2
2
  import { useMedia } from 'react-use';
3
- import Hls from 'hls.js';
4
- import {
5
- selectAppData,
6
- selectIsAllowedToPublish,
7
- selectLocalPeerID,
8
- selectLocalPeerRoleName,
9
- selectPermissions,
10
- useHMSActions,
11
- useHMSStore,
12
- useRecordingStreaming,
13
- } from '@100mslive/react-sdk';
14
- import {
15
- ChangeRoleIcon,
16
- CheckIcon,
17
- InfoIcon,
18
- MicOffIcon,
19
- PencilIcon,
20
- RecordIcon,
21
- SettingsIcon,
22
- VerticalMenuIcon,
23
- } from '@100mslive/react-icons';
24
- import { Box, Checkbox, config as cssConfig, Dropdown, Flex, Text, Tooltip } from '../../../';
25
- import IconButton from '../../IconButton';
26
- import { RoleChangeModal } from '../RoleChangeModal';
27
- import SettingsModal from '../Settings/SettingsModal';
28
- import StartRecording from '../Settings/StartRecording';
29
- import { StatsForNerds } from '../StatsForNerds';
30
- import { BulkRoleChangeModal } from './BulkRoleChangeModal';
31
- import { ChangeNameModal } from './ChangeNameModal';
32
- import { ChangeSelfRole } from './ChangeSelfRole';
33
- import { EmbedUrl, EmbedUrlModal } from './EmbedUrl';
34
- import { FullScreenItem } from './FullScreenItem';
35
- import { MuteAllModal } from './MuteAllModal';
36
- import { useDropdownList } from '../hooks/useDropdownList';
37
- import { useIsFeatureEnabled } from '../hooks/useFeatures';
38
- import { FeatureFlags } from '../../services/FeatureFlags';
39
- import { APP_DATA, FEATURE_LIST, isAndroid, isIOS, isMacOS } from '../../common/constants';
40
-
41
- const isMobileOS = isAndroid || isIOS;
42
-
43
- const MODALS = {
44
- CHANGE_NAME: 'changeName',
45
- SELF_ROLE_CHANGE: 'selfRoleChange',
46
- MORE_SETTINGS: 'moreSettings',
47
- START_RECORDING: 'startRecording',
48
- DEVICE_SETTINGS: 'deviceSettings',
49
- STATS_FOR_NERDS: 'statsForNerds',
50
- BULK_ROLE_CHANGE: 'bulkRoleChange',
51
- MUTE_ALL: 'muteAll',
52
- EMBED_URL: 'embedUrl',
53
- };
3
+ import { DesktopOptions } from './SplitComponents/DesktopOptions';
4
+ import { MwebOptions } from './SplitComponents/MwebOptions';
5
+ import { config as cssConfig } from '../../../';
54
6
 
55
7
  export const MoreSettings = () => {
56
- const permissions = useHMSStore(selectPermissions);
57
- const isAllowedToPublish = useHMSStore(selectIsAllowedToPublish);
58
- const localPeerId = useHMSStore(selectLocalPeerID);
59
- const localPeerRole = useHMSStore(selectLocalPeerRoleName);
60
- const hmsActions = useHMSActions();
61
- const enablHlsStats = useHMSStore(selectAppData(APP_DATA.hlsStats));
62
8
  const isMobile = useMedia(cssConfig.media.md);
63
- const { isBrowserRecordingOn } = useRecordingStreaming();
64
- const isChangeNameEnabled = useIsFeatureEnabled(FEATURE_LIST.CHANGE_NAME);
65
- const isEmbedEnabled = useIsFeatureEnabled(FEATURE_LIST.EMBED_URL);
66
- const isSFNEnabled = useIsFeatureEnabled(FEATURE_LIST.STARTS_FOR_NERDS);
67
- const [openModals, setOpenModals] = useState(new Set());
68
- useDropdownList({ open: openModals.size > 0, name: 'MoreSettings' });
69
-
70
- const updateState = (modalName, value) => {
71
- setOpenModals(modals => {
72
- const copy = new Set(modals);
73
- if (value) {
74
- copy.add(modalName);
75
- } else {
76
- copy.delete(modalName);
77
- }
78
- return copy;
79
- });
80
- };
81
-
82
- return (
83
- <Fragment>
84
- <Dropdown.Root
85
- open={openModals.has(MODALS.MORE_SETTINGS)}
86
- onOpenChange={value => updateState(MODALS.MORE_SETTINGS, value)}
87
- >
88
- <Dropdown.Trigger asChild data-testid="more_settings_btn">
89
- <IconButton>
90
- <Tooltip title="More options">
91
- <Box>
92
- <VerticalMenuIcon />
93
- </Box>
94
- </Tooltip>
95
- </IconButton>
96
- </Dropdown.Trigger>
97
-
98
- <Dropdown.Content
99
- sideOffset={5}
100
- align="center"
101
- css={{
102
- py: '$0',
103
- maxHeight: '$96',
104
- '@md': { w: '$64' },
105
- "div[role='separator']:first-child": {
106
- display: 'none',
107
- },
108
- }}
109
- >
110
- {isMobile && permissions?.browserRecording ? (
111
- <>
112
- <Dropdown.Item onClick={() => updateState(MODALS.START_RECORDING, true)}>
113
- <RecordIcon />
114
- <Text variant="sm" css={{ ml: '$4' }}>
115
- {isBrowserRecordingOn ? 'Stop' : 'Start'} Recording
116
- </Text>
117
- </Dropdown.Item>
118
- <Dropdown.ItemSeparator />
119
- </>
120
- ) : null}
121
- {isChangeNameEnabled && (
122
- <Dropdown.Item onClick={() => updateState(MODALS.CHANGE_NAME, true)} data-testid="change_name_btn">
123
- <PencilIcon />
124
- <Text variant="sm" css={{ ml: '$4' }}>
125
- Change Name
126
- </Text>
127
- </Dropdown.Item>
128
- )}
129
- <ChangeSelfRole onClick={() => updateState(MODALS.SELF_ROLE_CHANGE, true)} />
130
- {permissions?.changeRole && (
131
- <Dropdown.Item
132
- onClick={() => updateState(MODALS.BULK_ROLE_CHANGE, true)}
133
- data-testid="bulk_role_change_btn"
134
- >
135
- <ChangeRoleIcon />
136
- <Text variant="sm" css={{ ml: '$4' }}>
137
- Bulk Role Change
138
- </Text>
139
- </Dropdown.Item>
140
- )}
141
- <FullScreenItem />
142
- {isAllowedToPublish.screen && isEmbedEnabled && (
143
- <EmbedUrl setShowOpenUrl={() => updateState(MODALS.EMBED_URL, true)} />
144
- )}
145
- {permissions.mute && (
146
- <Dropdown.Item onClick={() => updateState(MODALS.MUTE_ALL, true)} data-testid="mute_all_btn">
147
- <MicOffIcon />
148
- <Text variant="sm" css={{ ml: '$4' }}>
149
- Mute All
150
- </Text>
151
- </Dropdown.Item>
152
- )}
153
- <Dropdown.ItemSeparator />
154
- <Dropdown.Item onClick={() => updateState(MODALS.DEVICE_SETTINGS, true)} data-testid="device_settings_btn">
155
- <SettingsIcon />
156
- <Text variant="sm" css={{ ml: '$4' }}>
157
- Settings
158
- </Text>
159
- </Dropdown.Item>
160
- {FeatureFlags.enableStatsForNerds &&
161
- isSFNEnabled &&
162
- (localPeerRole === 'hls-viewer' ? (
163
- Hls.isSupported() ? (
164
- <Dropdown.Item
165
- onClick={() => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats)}
166
- data-testid="hls_stats"
167
- >
168
- <Checkbox.Root
169
- css={{ margin: '$2' }}
170
- checked={enablHlsStats}
171
- onCheckedChange={() => hmsActions.setAppData(APP_DATA.hlsStats, !enablHlsStats)}
172
- >
173
- <Checkbox.Indicator>
174
- <CheckIcon width={16} height={16} />
175
- </Checkbox.Indicator>
176
- </Checkbox.Root>
177
- <Flex justify="between" css={{ width: '100%' }}>
178
- <Text variant="sm" css={{ ml: '$4' }}>
179
- Show HLS Stats
180
- </Text>
181
- {!isMobileOS ? (
182
- <Text variant="sm" css={{ ml: '$4' }}>
183
- {`${isMacOS ? '⌘' : 'ctrl'} + ]`}
184
- </Text>
185
- ) : null}
186
- </Flex>
187
- </Dropdown.Item>
188
- ) : null
189
- ) : (
190
- <Dropdown.Item
191
- onClick={() => updateState(MODALS.STATS_FOR_NERDS, true)}
192
- data-testid="stats_for_nreds_btn"
193
- >
194
- <InfoIcon />
195
- <Text variant="sm" css={{ ml: '$4' }}>
196
- Stats for Nerds
197
- </Text>
198
- </Dropdown.Item>
199
- ))}
200
- </Dropdown.Content>
201
- </Dropdown.Root>
202
- {openModals.has(MODALS.BULK_ROLE_CHANGE) && (
203
- <BulkRoleChangeModal onOpenChange={value => updateState(MODALS.BULK_ROLE_CHANGE, value)} />
204
- )}
205
- {openModals.has(MODALS.MUTE_ALL) && <MuteAllModal onOpenChange={value => updateState(MODALS.MUTE_ALL, value)} />}
206
- {openModals.has(MODALS.CHANGE_NAME) && (
207
- <ChangeNameModal onOpenChange={value => updateState(MODALS.CHANGE_NAME, value)} />
208
- )}
209
- {openModals.has(MODALS.DEVICE_SETTINGS) && (
210
- <SettingsModal open onOpenChange={value => updateState(MODALS.DEVICE_SETTINGS, value)} />
211
- )}
212
- {FeatureFlags.enableStatsForNerds && openModals.has(MODALS.STATS_FOR_NERDS) && (
213
- <StatsForNerds open onOpenChange={value => updateState(MODALS.STATS_FOR_NERDS, value)} />
214
- )}
215
- {openModals.has(MODALS.SELF_ROLE_CHANGE) && (
216
- <RoleChangeModal peerId={localPeerId} onOpenChange={value => updateState(MODALS.SELF_ROLE_CHANGE, value)} />
217
- )}
218
- {openModals.has(MODALS.START_RECORDING) && (
219
- <StartRecording open onOpenChange={value => updateState(MODALS.START_RECORDING, value)} />
220
- )}
221
- {openModals.has(MODALS.EMBED_URL) && (
222
- <EmbedUrlModal onOpenChange={value => updateState(MODALS.EMBED_URL, value)} />
223
- )}
224
- </Fragment>
225
- );
9
+ return isMobile ? <MwebOptions /> : <DesktopOptions />;
226
10
  };
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { Button } from '../../../Button';
3
+ import { Label } from '../../../Label';
4
+ import { Flex } from '../../../Layout';
5
+ import { RadioGroup } from '../../../RadioGroup';
6
+ import { Text } from '../../../Text';
7
+ import { DialogRow, DialogSelect } from '../../primitives/DialogContent';
8
+
9
+ export const MuteAllContent = props => {
10
+ const roles = props.roles || [];
11
+ return (
12
+ <>
13
+ <DialogSelect
14
+ title="Role"
15
+ options={[{ label: 'All Roles', value: '' }, ...roles.map(role => ({ label: role, value: role }))]}
16
+ selected={props.selectedRole}
17
+ keyField="value"
18
+ labelField="label"
19
+ onChange={props.setRole}
20
+ />
21
+ <DialogSelect
22
+ title="Track type"
23
+ options={props.trackTypeOptions}
24
+ selected={props.trackType}
25
+ onChange={props.setTrackType}
26
+ keyField="value"
27
+ labelField="label"
28
+ />
29
+ <DialogSelect
30
+ title="Track source"
31
+ options={props.trackSourceOptions}
32
+ selected={props.selectedSource}
33
+ onChange={props.setSource}
34
+ keyField="value"
35
+ labelField="label"
36
+ />
37
+ <DialogRow>
38
+ <Text variant="md">Track status</Text>
39
+ <RadioGroup.Root value={props.enabled} onValueChange={props.setEnabled}>
40
+ <Flex align="center" css={{ mr: '$8' }}>
41
+ <RadioGroup.Item value={false} id="trackDisableRadio" css={{ mr: '$4' }}>
42
+ <RadioGroup.Indicator />
43
+ </RadioGroup.Item>
44
+ <Label htmlFor="trackDisableRadio">Mute</Label>
45
+ </Flex>
46
+ <Flex align="center" css={{ cursor: 'pointer' }}>
47
+ <RadioGroup.Item value={true} id="trackEnableRadio" css={{ mr: '$4' }}>
48
+ <RadioGroup.Indicator />
49
+ </RadioGroup.Item>
50
+ <Label htmlFor="trackEnableRadio">Request Unmute</Label>
51
+ </Flex>
52
+ </RadioGroup.Root>
53
+ </DialogRow>
54
+ <DialogRow justify="end">
55
+ <Button variant="primary" onClick={props.muteAll} css={{ w: props?.isMobile ? '100%' : '' }}>
56
+ Apply
57
+ </Button>
58
+ </DialogRow>
59
+ </>
60
+ );
61
+ };
@@ -1,8 +1,10 @@
1
1
  import React, { useCallback, useState } from 'react';
2
2
  import { useHMSActions } from '@100mslive/react-sdk';
3
3
  import { MicOffIcon } from '@100mslive/react-icons';
4
- import { Button, Dialog, Flex, Label, RadioGroup, Text } from '../../../';
5
- import { DialogContent, DialogRow, DialogSelect } from '../../primitives/DialogContent';
4
+ import { Dialog } from '../../../';
5
+ import { Sheet } from '../../../Sheet';
6
+ import { DialogContent } from '../../primitives/DialogContent';
7
+ import { MuteAllContent } from './MuteAllContent';
6
8
  import { useFilteredRoles } from '../../common/hooks';
7
9
 
8
10
  const trackSourceOptions = [
@@ -17,7 +19,7 @@ const trackTypeOptions = [
17
19
  { label: 'audio', value: 'audio' },
18
20
  { label: 'video', value: 'video' },
19
21
  ];
20
- export const MuteAllModal = ({ onOpenChange }) => {
22
+ export const MuteAllModal = ({ onOpenChange, isMobile = false }) => {
21
23
  const roles = useFilteredRoles();
22
24
  const hmsActions = useHMSActions();
23
25
  const [enabled, setEnabled] = useState(false);
@@ -35,55 +37,36 @@ export const MuteAllModal = ({ onOpenChange }) => {
35
37
  onOpenChange(false);
36
38
  }, [selectedRole, enabled, trackType, selectedSource, hmsActions, onOpenChange]);
37
39
 
40
+ const props = {
41
+ muteAll,
42
+ roles,
43
+ enabled,
44
+ setEnabled,
45
+ trackType,
46
+ setTrackType,
47
+ selectedRole,
48
+ setRole,
49
+ selectedSource,
50
+ setSource,
51
+ trackSourceOptions,
52
+ trackTypeOptions,
53
+ isMobile,
54
+ };
55
+
56
+ if (isMobile) {
57
+ return (
58
+ <Sheet.Root defaultOpen onOpenChange={onOpenChange}>
59
+ <Sheet.Content css={{ px: '$10' }}>
60
+ <MuteAllContent {...props} />
61
+ </Sheet.Content>
62
+ </Sheet.Root>
63
+ );
64
+ }
65
+
38
66
  return (
39
67
  <Dialog.Root defaultOpen onOpenChange={onOpenChange}>
40
68
  <DialogContent title="Mute/Unmute Remote Tracks" Icon={MicOffIcon}>
41
- <DialogSelect
42
- title="Role"
43
- options={[{ label: 'All Roles', value: '' }, ...roles.map(role => ({ label: role, value: role }))]}
44
- selected={selectedRole}
45
- keyField="value"
46
- labelField="label"
47
- onChange={setRole}
48
- />
49
- <DialogSelect
50
- title="Track type"
51
- options={trackTypeOptions}
52
- selected={trackType}
53
- onChange={setTrackType}
54
- keyField="value"
55
- labelField="label"
56
- />
57
- <DialogSelect
58
- title="Track source"
59
- options={trackSourceOptions}
60
- selected={selectedSource}
61
- onChange={setSource}
62
- keyField="value"
63
- labelField="label"
64
- />
65
- <DialogRow>
66
- <Text variant="md">Track status</Text>
67
- <RadioGroup.Root value={enabled} onValueChange={setEnabled}>
68
- <Flex align="center" css={{ mr: '$8' }}>
69
- <RadioGroup.Item value={false} id="trackDisableRadio" css={{ mr: '$4' }}>
70
- <RadioGroup.Indicator />
71
- </RadioGroup.Item>
72
- <Label htmlFor="trackDisableRadio">Mute</Label>
73
- </Flex>
74
- <Flex align="center" css={{ cursor: 'pointer' }}>
75
- <RadioGroup.Item value={true} id="trackEnableRadio" css={{ mr: '$4' }}>
76
- <RadioGroup.Indicator />
77
- </RadioGroup.Item>
78
- <Label htmlFor="trackEnableRadio">Request Unmute</Label>
79
- </Flex>
80
- </RadioGroup.Root>
81
- </DialogRow>
82
- <DialogRow justify="end">
83
- <Button variant="primary" onClick={muteAll}>
84
- Apply
85
- </Button>
86
- </DialogRow>
69
+ <MuteAllContent {...props} />
87
70
  </DialogContent>
88
71
  </Dialog.Root>
89
72
  );
@@ -0,0 +1,129 @@
1
+ import React, { Fragment, useState } from 'react';
2
+ import { selectIsConnectedToRoom, selectPermissions, useHMSStore, useRecordingStreaming } from '@100mslive/react-sdk';
3
+ import { ExitIcon, StopIcon, VerticalMenuIcon } from '@100mslive/react-icons';
4
+ import { Dropdown } from '../../../../Dropdown';
5
+ import { Box, Flex } from '../../../../Layout';
6
+ import { Dialog } from '../../../../Modal';
7
+ import { Tooltip } from '../../../../Tooltip';
8
+ import { EndSessionContent } from '../../EndSessionContent';
9
+ import { LeaveCard } from '../../LeaveCard';
10
+ import { useDropdownList } from '../../hooks/useDropdownList';
11
+ import { useShowStreamingUI } from '../../../common/hooks';
12
+
13
+ export const DesktopLeaveRoom = ({
14
+ menuTriggerButton: MenuTriggerButton,
15
+ leaveIconButton: LeaveIconButton,
16
+ leaveRoom,
17
+ stopStream,
18
+ }) => {
19
+ const [open, setOpen] = useState(false);
20
+ const [showEndStreamAlert, setShowEndStreamAlert] = useState(false);
21
+ const isConnected = useHMSStore(selectIsConnectedToRoom);
22
+ const permissions = useHMSStore(selectPermissions);
23
+ const { isStreamingOn } = useRecordingStreaming();
24
+ const showStreamingUI = useShowStreamingUI();
25
+
26
+ const showStream = showStreamingUI && isStreamingOn;
27
+
28
+ useDropdownList({ open, name: 'LeaveRoom' });
29
+
30
+ if (!permissions || !isConnected) {
31
+ return null;
32
+ }
33
+
34
+ return (
35
+ <Fragment>
36
+ {permissions.hlsStreaming ? (
37
+ <Flex>
38
+ <LeaveIconButton
39
+ variant="danger"
40
+ key="LeaveRoom"
41
+ data-testid="leave_room_btn"
42
+ css={{
43
+ borderTopRightRadius: 0,
44
+ borderBottomRightRadius: 0,
45
+ }}
46
+ onClick={leaveRoom}
47
+ >
48
+ <Tooltip title="Leave Room">
49
+ <Box>
50
+ <ExitIcon style={{ transform: 'rotate(180deg)' }} />
51
+ </Box>
52
+ </Tooltip>
53
+ </LeaveIconButton>
54
+ <Dropdown.Root open={open} onOpenChange={setOpen} modal={false}>
55
+ <Dropdown.Trigger
56
+ asChild
57
+ css={{
58
+ '&[data-state="open"]': {
59
+ bg: '$alert_error_dim',
60
+ },
61
+ }}
62
+ >
63
+ <MenuTriggerButton variant="danger" data-testid="leave_end_dropdown_trigger">
64
+ <VerticalMenuIcon />
65
+ </MenuTriggerButton>
66
+ </Dropdown.Trigger>
67
+ <Dropdown.Content css={{ p: 0, w: '$100' }} alignOffset={-50} sideOffset={10}>
68
+ <Dropdown.Item css={{ bg: '$surface_default' }} onClick={leaveRoom} data-testid="just_leave_btn">
69
+ <LeaveCard
70
+ title={showStream ? 'Leave Stream' : 'Leave Session'}
71
+ subtitle={`Others will continue after you leave. You can join the ${
72
+ showStream ? 'stream' : 'session'
73
+ } again.`}
74
+ bg=""
75
+ titleColor="$on_surface_high"
76
+ subtitleColor="$on_surface_low"
77
+ icon={<ExitIcon height={24} width={24} style={{ transform: 'rotate(180deg)' }} />}
78
+ onClick={leaveRoom}
79
+ css={{ p: 0 }}
80
+ />
81
+ </Dropdown.Item>
82
+ {isStreamingOn && permissions?.hlsStreaming ? (
83
+ <Dropdown.Item css={{ bg: '$alert_error_dim' }} data-testid="end_room_btn">
84
+ <LeaveCard
85
+ title={showStream ? 'End Stream' : 'End Session'}
86
+ subtitle={`The ${
87
+ showStream ? 'stream' : 'session'
88
+ } will end for everyone. You can't undo this action.`}
89
+ bg=""
90
+ titleColor="$alert_error_brighter"
91
+ subtitleColor="$alert_error_bright"
92
+ icon={<StopIcon height={24} width={24} />}
93
+ onClick={() => {
94
+ setOpen(false);
95
+ setShowEndStreamAlert(true);
96
+ }}
97
+ css={{ p: 0 }}
98
+ />
99
+ </Dropdown.Item>
100
+ ) : null}
101
+ </Dropdown.Content>
102
+ </Dropdown.Root>
103
+ </Flex>
104
+ ) : (
105
+ <LeaveIconButton onClick={leaveRoom} variant="danger" key="LeaveRoom" data-testid="leave_room_btn">
106
+ <Tooltip title="Leave Room">
107
+ <Box>
108
+ <ExitIcon style={{ transform: 'rotate(180deg)' }} />
109
+ </Box>
110
+ </Tooltip>
111
+ </LeaveIconButton>
112
+ )}
113
+
114
+ <Dialog.Root open={showEndStreamAlert} modal={false}>
115
+ <Dialog.Portal>
116
+ <Dialog.Overlay />
117
+ <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
118
+ <EndSessionContent
119
+ setShowEndStreamAlert={setShowEndStreamAlert}
120
+ stopStream={stopStream}
121
+ leaveRoom={leaveRoom}
122
+ isModal
123
+ />
124
+ </Dialog.Content>
125
+ </Dialog.Portal>
126
+ </Dialog.Root>
127
+ </Fragment>
128
+ );
129
+ };