@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.
Files changed (166) hide show
  1. package/dist/{HLSView-T267ZHOS.js → HLSView-CTAJQUU4.js} +7 -11
  2. package/dist/{HLSView-T267ZHOS.js.map → HLSView-CTAJQUU4.js.map} +1 -1
  3. package/dist/PinnedTrackView-CQKONH4O.js +102 -0
  4. package/dist/PinnedTrackView-CQKONH4O.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-BCKXNDTD.js → VirtualBackground-GGGBJYVY.js} +31 -7
  14. package/dist/VirtualBackground-GGGBJYVY.js.map +7 -0
  15. package/dist/chunk-I2FJWE74.js +827 -0
  16. package/dist/chunk-I2FJWE74.js.map +7 -0
  17. package/dist/{chunk-NLZVUXR3.js → chunk-L2SX7GBO.js} +3020 -2189
  18. package/dist/chunk-L2SX7GBO.js.map +7 -0
  19. package/dist/chunk-NOKIGB6Y.js +1100 -0
  20. package/dist/chunk-NOKIGB6Y.js.map +7 -0
  21. package/dist/chunk-TJNDX446.js +67 -0
  22. package/dist/chunk-TJNDX446.js.map +7 -0
  23. package/dist/{chunk-3HMUOAD6.js → conference-OEO7VOJD.js} +3136 -653
  24. package/dist/conference-OEO7VOJD.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 +3248 -3039
  29. package/dist/meta.esbuild.json +3398 -3386
  30. package/dist/utils/animations.d.ts +16 -0
  31. package/package.json +8 -11
  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/WhiteboardView.jsx +2 -4
  111. package/src/Prebuilt/layouts/mainView.jsx +22 -31
  112. package/src/Prebuilt/layouts/screenShareView.jsx +0 -2
  113. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +25 -1
  114. package/src/Prebuilt/plugins/whiteboard/index.js +1 -1
  115. package/src/Prebuilt/primitives/DialogContent.jsx +1 -1
  116. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +1 -1
  117. package/src/Sheet/Sheet.mdx +19 -0
  118. package/src/Sheet/Sheet.stories.tsx +103 -0
  119. package/src/Sheet/Sheet.tsx +118 -0
  120. package/src/Sheet/index.ts +1 -0
  121. package/src/Theme/ThemeProvider.tsx +10 -13
  122. package/src/Theme/base.config.ts +1 -1
  123. package/src/Theme/stitches.config.ts +1 -1
  124. package/src/TileMenu/StyledMenuTile.tsx +2 -2
  125. package/src/TileMenu/TileMenu.tsx +2 -0
  126. package/src/VideoTile/StyledVideoTile.tsx +5 -0
  127. package/src/utils/animations.ts +18 -0
  128. package/dist/ActiveSpeakerView-AGL73O6U.css +0 -11
  129. package/dist/ActiveSpeakerView-AGL73O6U.css.map +0 -7
  130. package/dist/ActiveSpeakerView-UPFD5RXA.js +0 -39
  131. package/dist/ActiveSpeakerView-UPFD5RXA.js.map +0 -7
  132. package/dist/HLSView-64OG755F.css +0 -11
  133. package/dist/HLSView-64OG755F.css.map +0 -7
  134. package/dist/PinnedTrackView-O4FHHHOV.js +0 -70
  135. package/dist/PinnedTrackView-O4FHHHOV.js.map +0 -7
  136. package/dist/PinnedTrackView-YWAZ2342.css +0 -11
  137. package/dist/PinnedTrackView-YWAZ2342.css.map +0 -7
  138. package/dist/VirtualBackground-BCKXNDTD.js.map +0 -7
  139. package/dist/chunk-3HMUOAD6.js.map +0 -7
  140. package/dist/chunk-6GXDYWD5.js +0 -243
  141. package/dist/chunk-6GXDYWD5.js.map +0 -7
  142. package/dist/chunk-NLZVUXR3.js.map +0 -7
  143. package/dist/chunk-ORPC2GYB.js +0 -58
  144. package/dist/chunk-ORPC2GYB.js.map +0 -7
  145. package/dist/chunk-YE4RPJYG.js +0 -811
  146. package/dist/chunk-YE4RPJYG.js.map +0 -7
  147. package/dist/conference-7KHWJZLG.css +0 -11
  148. package/dist/conference-7KHWJZLG.css.map +0 -7
  149. package/dist/conference-ETISNCLN.js +0 -3697
  150. package/dist/conference-ETISNCLN.js.map +0 -7
  151. package/dist/index.cjs.css +0 -11
  152. package/dist/index.cjs.css.map +0 -7
  153. package/dist/index.css +0 -11
  154. package/dist/index.css.map +0 -7
  155. package/dist/transcription-JJQ4UAIK.js +0 -356
  156. package/dist/transcription-JJQ4UAIK.js.map +0 -7
  157. package/src/Prebuilt/common/useSortedPeers.js +0 -28
  158. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.jsx +0 -96
  159. package/src/Prebuilt/components/BottomActionSheet/BottomActionSheet.stories.tsx +0 -46
  160. package/src/Prebuilt/components/Footer/ConferencingFooter.jsx +0 -101
  161. package/src/Prebuilt/components/Footer/StreamingFooter.jsx +0 -71
  162. package/src/Prebuilt/components/Footer.jsx +0 -8
  163. package/src/Prebuilt/components/MoreSettings/ChangeSelfRole.jsx +0 -67
  164. package/src/Prebuilt/components/TileMenu.jsx +0 -268
  165. package/src/Prebuilt/index.d.ts +0 -20
  166. package/src/Prebuilt/index.js +0 -2
@@ -1,101 +0,0 @@
1
- import React, { Fragment, Suspense, useState } from 'react';
2
- import { useMedia } from 'react-use';
3
- import { selectIsAllowedToPublish, useHMSStore, useScreenShare } from '@100mslive/react-sdk';
4
- import { MusicIcon } from '@100mslive/react-icons';
5
- import { config as cssConfig, Flex, Footer as AppFooter, Tooltip } from '../../../';
6
- import IconButton from '../../IconButton';
7
- import { AudioVideoToggle } from '../AudioVideoToggle';
8
- import { EmojiReaction } from '../EmojiReaction';
9
- import { LeaveRoom } from '../LeaveRoom';
10
- import MetaActions from '../MetaActions';
11
- import { MoreSettings } from '../MoreSettings/MoreSettings';
12
- import { PIP } from '../PIP';
13
- import { ScreenshareToggle } from '../ScreenShare';
14
- import { ScreenShareHintModal } from '../ScreenshareHintModal';
15
- import { ChatToggle } from './ChatToggle';
16
- import { useIsFeatureEnabled } from '../hooks/useFeatures';
17
- import { isScreenshareSupported } from '../../common/utils';
18
- import { FeatureFlags } from '../../services/FeatureFlags';
19
- import { FEATURE_LIST } from '../../common/constants';
20
-
21
- const TranscriptionButton = React.lazy(() => import('../../plugins/transcription'));
22
- const VirtualBackground = React.lazy(() => import('../../plugins/VirtualBackground/VirtualBackground'));
23
-
24
- const ScreenshareAudio = () => {
25
- const {
26
- amIScreenSharing,
27
- screenShareVideoTrackId: video,
28
- screenShareAudioTrackId: audio,
29
- toggleScreenShare,
30
- } = useScreenShare();
31
- const isAllowedToPublish = useHMSStore(selectIsAllowedToPublish);
32
- const isAudioScreenshare = amIScreenSharing && !video && !!audio;
33
- const [showModal, setShowModal] = useState(false);
34
- const isFeatureEnabled = useIsFeatureEnabled(FEATURE_LIST.AUDIO_ONLY_SCREENSHARE);
35
- if (!isFeatureEnabled || !isAllowedToPublish.screen || !isScreenshareSupported()) {
36
- return null;
37
- }
38
- return (
39
- <Fragment>
40
- <Tooltip title={`${!isAudioScreenshare ? 'Start' : 'Stop'} audio sharing`} key="shareAudio">
41
- <IconButton
42
- active={!isAudioScreenshare}
43
- onClick={() => {
44
- if (amIScreenSharing) {
45
- toggleScreenShare();
46
- } else {
47
- setShowModal(true);
48
- }
49
- }}
50
- data-testid="screenshare_audio"
51
- >
52
- <MusicIcon />
53
- </IconButton>
54
- </Tooltip>
55
- {showModal && <ScreenShareHintModal onClose={() => setShowModal(false)} />}
56
- </Fragment>
57
- );
58
- };
59
-
60
- export const ConferencingFooter = () => {
61
- const isMobile = useMedia(cssConfig.media.md);
62
- return (
63
- <AppFooter.Root>
64
- <AppFooter.Left>
65
- <ScreenshareAudio />
66
- <Suspense fallback="">
67
- <VirtualBackground />
68
- </Suspense>
69
- {FeatureFlags.enableTranscription ? <TranscriptionButton /> : null}
70
- <Flex
71
- align="center"
72
- css={{
73
- display: 'none',
74
- '@md': {
75
- display: 'flex',
76
- gap: '$8',
77
- },
78
- }}
79
- >
80
- {isMobile && <EmojiReaction />}
81
- <MetaActions isMobile />
82
- </Flex>
83
- </AppFooter.Left>
84
- <AppFooter.Center>
85
- <AudioVideoToggle />
86
- <ScreenshareToggle />
87
- <PIP />
88
- <MoreSettings />
89
- <Flex align="center" css={{ display: 'none', '@md': { display: 'flex' } }}>
90
- <ChatToggle />
91
- </Flex>
92
- <LeaveRoom />
93
- </AppFooter.Center>
94
- <AppFooter.Right>
95
- {!isMobile && <EmojiReaction />}
96
- <MetaActions />
97
- <ChatToggle />
98
- </AppFooter.Right>
99
- </AppFooter.Root>
100
- );
101
- };
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import { Box, Flex, Footer as AppFooter } from '../../../';
3
- import { AudioVideoToggle } from '../AudioVideoToggle';
4
- import { EmojiReaction } from '../EmojiReaction';
5
- import { StreamActions } from '../Header/StreamActions';
6
- import { LeaveRoom } from '../LeaveRoom';
7
- import MetaActions from '../MetaActions';
8
- import { MoreSettings } from '../MoreSettings/MoreSettings';
9
- import { PIP } from '../PIP';
10
- import { ScreenshareToggle } from '../ScreenShare';
11
- import { ChatToggle } from './ChatToggle';
12
-
13
- export const StreamingFooter = () => {
14
- return (
15
- <AppFooter.Root
16
- css={{
17
- flexWrap: 'nowrap',
18
- '@md': {
19
- justifyContent: 'center',
20
- },
21
- }}
22
- >
23
- <AppFooter.Left
24
- css={{
25
- '@md': {
26
- w: 'unset',
27
- p: '0',
28
- },
29
- }}
30
- >
31
- <AudioVideoToggle />
32
- </AppFooter.Left>
33
- <AppFooter.Center
34
- css={{
35
- '@md': {
36
- w: 'unset',
37
- },
38
- }}
39
- >
40
- <ScreenshareToggle css={{ '@sm': { display: 'none' } }} />
41
- <Box css={{ '@md': { display: 'none' } }}>
42
- <PIP />
43
- </Box>
44
- <Box
45
- css={{
46
- display: 'none',
47
- '@md': {
48
- display: 'flex',
49
- alignItems: 'center',
50
- mx: '$4',
51
- },
52
- }}
53
- >
54
- <StreamActions />
55
- </Box>
56
- <MoreSettings />
57
- <Box css={{ '@md': { display: 'none' } }}>
58
- <LeaveRoom />
59
- </Box>
60
- <Flex align="center" css={{ display: 'none', '@md': { display: 'flex' } }}>
61
- <ChatToggle />
62
- </Flex>
63
- </AppFooter.Center>
64
- <AppFooter.Right>
65
- <EmojiReaction />
66
- <MetaActions />
67
- <ChatToggle />
68
- </AppFooter.Right>
69
- </AppFooter.Root>
70
- );
71
- };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import { ConferencingFooter } from './Footer/ConferencingFooter';
3
- import { StreamingFooter } from './Footer/StreamingFooter';
4
- import { isStreamingKit } from '../common/utils';
5
-
6
- export const Footer = () => {
7
- return isStreamingKit() ? <StreamingFooter /> : <ConferencingFooter />;
8
- };
@@ -1,67 +0,0 @@
1
- import React, { useMemo } from 'react';
2
- import { useMedia } from 'react-use';
3
- import {
4
- selectLocalPeerID,
5
- selectLocalPeerRoleName,
6
- selectPermissions,
7
- useHMSActions,
8
- useHMSStore,
9
- } from '@100mslive/react-sdk';
10
- import { ArrowRightIcon, CheckIcon, PersonIcon } from '@100mslive/react-icons';
11
- import { config, Dropdown, Text } from '../../../';
12
- import { ToastManager } from '../Toast/ToastManager';
13
- import { useAppLayout } from '../AppData/useAppLayout';
14
- import { useFilteredRoles } from '../../common/hooks';
15
- import { arrayIntersection } from '../../common/utils';
16
-
17
- export const ChangeSelfRole = ({ onClick }) => {
18
- const roles = useFilteredRoles();
19
- const permissions = useHMSStore(selectPermissions);
20
- const localPeerId = useHMSStore(selectLocalPeerID);
21
- const localPeerRole = useHMSStore(selectLocalPeerRoleName);
22
- const hmsActions = useHMSActions();
23
- const hideTriggerItem = useMedia(config.media.sm);
24
- const selfRoleChangeTo = useAppLayout('selfRoleChangeTo');
25
- const availableSelfChangeRoles = useMemo(() => arrayIntersection(selfRoleChangeTo, roles), [roles, selfRoleChangeTo]);
26
-
27
- if (!permissions.changeRole) {
28
- return null;
29
- }
30
- return hideTriggerItem ? (
31
- <Dropdown.Item onClick={onClick}>
32
- <PersonIcon />
33
- <Text variant="sm" css={{ mx: '$4' }}>
34
- Change My Role
35
- </Text>
36
- </Dropdown.Item>
37
- ) : (
38
- <Dropdown.SubMenu>
39
- <Dropdown.TriggerItem data-testid="change_my_role_btn">
40
- <PersonIcon />
41
- <Text variant="sm" css={{ flex: '1 1 0', mx: '$4' }}>
42
- Change My Role
43
- </Text>
44
- <ArrowRightIcon />
45
- </Dropdown.TriggerItem>
46
- <Dropdown.SubMenuContent sideOffset={8} alignOffset={-5} css={{ py: '$0', '@md': { w: '$64' } }}>
47
- {availableSelfChangeRoles.map(role => (
48
- <Dropdown.Item
49
- key={role}
50
- css={{ justifyContent: 'space-between' }}
51
- onClick={async () => {
52
- try {
53
- await hmsActions.changeRole(localPeerId, role, true);
54
- } catch (error) {
55
- ToastManager.addToast({ title: error.message });
56
- }
57
- }}
58
- data-testid={'change_to_role_' + role}
59
- >
60
- <Text variant="sm">{role}</Text>
61
- {localPeerRole === role && <CheckIcon width={16} height={16} />}
62
- </Dropdown.Item>
63
- ))}
64
- </Dropdown.SubMenuContent>
65
- </Dropdown.SubMenu>
66
- );
67
- };
@@ -1,268 +0,0 @@
1
- import React, { Fragment, useState } from 'react';
2
- import {
3
- selectLocalPeerID,
4
- selectPermissions,
5
- selectSessionStore,
6
- selectTemplateAppData,
7
- selectTrackByID,
8
- selectVideoTrackByPeerID,
9
- useCustomEvent,
10
- useHMSActions,
11
- useHMSStore,
12
- useRemoteAVToggle,
13
- } from '@100mslive/react-sdk';
14
- import {
15
- HorizontalMenuIcon,
16
- MicOffIcon,
17
- MicOnIcon,
18
- PinIcon,
19
- RemoveUserIcon,
20
- ShareScreenIcon,
21
- SpeakerIcon,
22
- StarIcon,
23
- VideoOffIcon,
24
- VideoOnIcon,
25
- } from '@100mslive/react-icons';
26
- import { ToastManager } from './Toast/ToastManager';
27
- import { Box, Flex } from '../../Layout';
28
- import { Slider } from '../../Slider';
29
- import { Text } from '../../Text';
30
- import { StyledMenuTile } from '../../TileMenu';
31
- import { useSetAppDataByKey } from './AppData/useUISettings';
32
- import { useDropdownList } from './hooks/useDropdownList';
33
- import { useDropdownSelection } from './hooks/useDropdownSelection';
34
- import { useIsFeatureEnabled } from './hooks/useFeatures';
35
- import { APP_DATA, FEATURE_LIST, REMOTE_STOP_SCREENSHARE_TYPE, SESSION_STORE_KEY } from '../common/constants';
36
-
37
- const isSameTile = ({ trackId, videoTrackID, audioTrackID }) =>
38
- trackId && ((videoTrackID && videoTrackID === trackId) || (audioTrackID && audioTrackID === trackId));
39
-
40
- const SpotlightActions = ({ peerId }) => {
41
- const hmsActions = useHMSActions();
42
- const spotlightPeerId = useHMSStore(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT));
43
- const isTileSpotlighted = spotlightPeerId === peerId;
44
-
45
- const setSpotlightPeerId = peer =>
46
- hmsActions.sessionStore
47
- .set(SESSION_STORE_KEY.SPOTLIGHT, peer)
48
- .catch(err => ToastManager.addToast({ title: err.description }));
49
-
50
- return (
51
- <StyledMenuTile.ItemButton onClick={() => (isTileSpotlighted ? setSpotlightPeerId() : setSpotlightPeerId(peerId))}>
52
- <StarIcon />
53
- <span>{isTileSpotlighted ? 'Remove from Spotlight' : 'Spotlight Tile for everyone'}</span>
54
- </StyledMenuTile.ItemButton>
55
- );
56
- };
57
-
58
- const PinActions = ({ audioTrackID, videoTrackID }) => {
59
- const [pinnedTrackId, setPinnedTrackId] = useSetAppDataByKey(APP_DATA.pinnedTrackId);
60
-
61
- const isTilePinned = isSameTile({
62
- trackId: pinnedTrackId,
63
- videoTrackID,
64
- audioTrackID,
65
- });
66
-
67
- return (
68
- <>
69
- <StyledMenuTile.ItemButton
70
- onClick={() => (isTilePinned ? setPinnedTrackId() : setPinnedTrackId(videoTrackID || audioTrackID))}
71
- >
72
- <PinIcon />
73
- <span>{isTilePinned ? 'Unpin' : 'Pin'} Tile for myself</span>
74
- </StyledMenuTile.ItemButton>
75
- </>
76
- );
77
- };
78
-
79
- /**
80
- * Taking peerID as peer won't necesarilly have tracks
81
- */
82
- const TileMenu = ({ audioTrackID, videoTrackID, peerID, isScreenshare = false }) => {
83
- const [open, setOpen] = useState(false);
84
- const actions = useHMSActions();
85
- const localPeerID = useHMSStore(selectLocalPeerID);
86
- const isLocal = localPeerID === peerID;
87
- const { removeOthers, changeRole } = useHMSStore(selectPermissions);
88
- const { isAudioEnabled, isVideoEnabled, setVolume, toggleAudio, toggleVideo, volume } = useRemoteAVToggle(
89
- audioTrackID,
90
- videoTrackID,
91
- );
92
- const showSpotlight = changeRole;
93
- const { sendEvent } = useCustomEvent({
94
- type: REMOTE_STOP_SCREENSHARE_TYPE,
95
- });
96
-
97
- const isPrimaryVideoTrack = useHMSStore(selectVideoTrackByPeerID(peerID))?.id === videoTrackID;
98
- const uiMode = useHMSStore(selectTemplateAppData).uiMode;
99
- const isInset = uiMode === 'inset';
100
-
101
- const isPinEnabled = useIsFeatureEnabled(FEATURE_LIST.PIN_TILE);
102
- const showPinAction = isPinEnabled && (audioTrackID || (videoTrackID && isPrimaryVideoTrack)) && !isInset;
103
-
104
- const track = useHMSStore(selectTrackByID(videoTrackID));
105
- const hideSimulcastLayers = !track?.layerDefinitions?.length || track.degraded || !track.enabled;
106
-
107
- useDropdownList({ open, name: 'TileMenu' });
108
-
109
- if (!(removeOthers || toggleAudio || toggleVideo || setVolume || showPinAction) && hideSimulcastLayers) {
110
- return null;
111
- }
112
-
113
- if (isInset && isLocal) {
114
- return null;
115
- }
116
-
117
- return (
118
- <StyledMenuTile.Root open={open} onOpenChange={setOpen}>
119
- <StyledMenuTile.Trigger data-testid="participant_menu_btn" onClick={e => e.stopPropagation()}>
120
- <HorizontalMenuIcon />
121
- </StyledMenuTile.Trigger>
122
- <StyledMenuTile.Content side="top" align="end">
123
- {isLocal ? (
124
- showPinAction && (
125
- <>
126
- <PinActions audioTrackID={audioTrackID} videoTrackID={videoTrackID} />
127
- {showSpotlight && <SpotlightActions peerId={peerID} />}
128
- </>
129
- )
130
- ) : (
131
- <>
132
- {toggleVideo ? (
133
- <StyledMenuTile.ItemButton
134
- onClick={toggleVideo}
135
- data-testid={isVideoEnabled ? 'mute_video_participant_btn' : 'unmute_video_participant_btn'}
136
- >
137
- {isVideoEnabled ? <VideoOnIcon /> : <VideoOffIcon />}
138
- <span>{isVideoEnabled ? 'Mute' : 'Request Unmute'}</span>
139
- </StyledMenuTile.ItemButton>
140
- ) : null}
141
- {toggleAudio ? (
142
- <StyledMenuTile.ItemButton
143
- onClick={toggleAudio}
144
- data-testid={isVideoEnabled ? 'mute_audio_participant_btn' : 'unmute_audio_participant_btn'}
145
- >
146
- {isAudioEnabled ? <MicOnIcon /> : <MicOffIcon />}
147
- <span>{isAudioEnabled ? 'Mute' : 'Request Unmute'}</span>
148
- </StyledMenuTile.ItemButton>
149
- ) : null}
150
- {audioTrackID ? (
151
- <StyledMenuTile.VolumeItem data-testid="participant_volume_slider">
152
- <Flex align="center" gap={1}>
153
- <SpeakerIcon />
154
- <Box as="span" css={{ ml: '$4' }}>
155
- Volume ({volume})
156
- </Box>
157
- </Flex>
158
- <Slider css={{ my: '0.5rem' }} step={5} value={[volume]} onValueChange={e => setVolume(e[0])} />
159
- </StyledMenuTile.VolumeItem>
160
- ) : null}
161
- {showPinAction && (
162
- <>
163
- <PinActions audioTrackID={audioTrackID} videoTrackID={videoTrackID} />
164
- {showSpotlight && <SpotlightActions peerId={peerID} />}
165
- </>
166
- )}
167
- <SimulcastLayers trackId={videoTrackID} />
168
- {removeOthers ? (
169
- <StyledMenuTile.RemoveItem
170
- onClick={async () => {
171
- try {
172
- await actions.removePeer(peerID, '');
173
- } catch (error) {
174
- // TODO: Toast here
175
- }
176
- }}
177
- data-testid="remove_participant_btn"
178
- >
179
- <RemoveUserIcon />
180
- <span>Remove Participant</span>
181
- </StyledMenuTile.RemoveItem>
182
- ) : null}
183
-
184
- {removeOthers && isScreenshare ? (
185
- <StyledMenuTile.RemoveItem onClick={() => sendEvent({})}>
186
- <ShareScreenIcon />
187
- <span>Stop Screenshare</span>
188
- </StyledMenuTile.RemoveItem>
189
- ) : null}
190
- </>
191
- )}
192
- </StyledMenuTile.Content>
193
- </StyledMenuTile.Root>
194
- );
195
- };
196
-
197
- const SimulcastLayers = ({ trackId }) => {
198
- const track = useHMSStore(selectTrackByID(trackId));
199
- const actions = useHMSActions();
200
- const bg = useDropdownSelection();
201
- if (!track?.layerDefinitions?.length || track.degraded || !track.enabled) {
202
- return null;
203
- }
204
- const currentLayer = track.layerDefinitions.find(layer => layer.layer === track.layer);
205
- return (
206
- <Fragment>
207
- <StyledMenuTile.ItemButton css={{ color: '$on_surface_medium', cursor: 'default' }}>
208
- Select maximum resolution
209
- </StyledMenuTile.ItemButton>
210
- {track.layerDefinitions.map(layer => {
211
- return (
212
- <StyledMenuTile.ItemButton
213
- key={layer.layer}
214
- onClick={async () => {
215
- await actions.setPreferredLayer(trackId, layer.layer);
216
- }}
217
- css={{
218
- justifyContent: 'space-between',
219
- bg: track.preferredLayer === layer.layer ? bg : undefined,
220
- '&:hover': {
221
- bg: track.preferredLayer === layer.layer ? bg : undefined,
222
- },
223
- }}
224
- >
225
- <Text
226
- as="span"
227
- css={{
228
- textTransform: 'capitalize',
229
- mr: '$2',
230
- fontWeight: track.preferredLayer === layer.layer ? '$semiBold' : '$regular',
231
- }}
232
- >
233
- {layer.layer}
234
- </Text>
235
- <Text as="span" variant="xs" css={{ color: '$on_surface_medium' }}>
236
- {layer.resolution.width}x{layer.resolution.height}
237
- </Text>
238
- </StyledMenuTile.ItemButton>
239
- );
240
- })}
241
- <StyledMenuTile.ItemButton>
242
- <Text as="span" variant="xs" css={{ color: '$on_surface_medium' }}>
243
- Currently streaming:
244
- <Text
245
- as="span"
246
- variant="xs"
247
- css={{
248
- fontWeight: '$semiBold',
249
- textTransform: 'capitalize',
250
- color: '$on_surface_medium',
251
- ml: '$2',
252
- }}
253
- >
254
- {currentLayer ? (
255
- <>
256
- {track.layer} ({currentLayer.resolution.width}x{currentLayer.resolution.height})
257
- </>
258
- ) : (
259
- '-'
260
- )}
261
- </Text>
262
- </Text>
263
- </StyledMenuTile.ItemButton>
264
- </Fragment>
265
- );
266
- };
267
-
268
- export default TileMenu;
@@ -1,20 +0,0 @@
1
- import React from 'react';
2
- import type { Screens, Theme, Typography } from '@100mslive/types-prebuilt';
3
-
4
- export declare const HMSPrebuilt: React.FC<{
5
- roomCode: string;
6
- logo?: {
7
- url: string;
8
- };
9
- themes?: Theme[];
10
- typography?: Typography;
11
- screens?: Screens;
12
- options?: {
13
- endpoints?: {
14
- tokenByRoomIdRole?: string;
15
- tokenByRoomCode?: string;
16
- init?: string;
17
- roomLayout?: string;
18
- };
19
- };
20
- }>;
@@ -1,2 +0,0 @@
1
- import { HMSPrebuilt } from './App.jsx';
2
- export { HMSPrebuilt };