@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.
Files changed (232) hide show
  1. package/dist/{HLSView-P57IRMAR.js → HLSView-HNVYG5VE.js} +309 -151
  2. package/dist/HLSView-HNVYG5VE.js.map +7 -0
  3. package/dist/Prebuilt/App.d.ts +3 -0
  4. package/dist/Prebuilt/AppContext.d.ts +13 -0
  5. package/dist/Prebuilt/common/PeersSorter.d.ts +21 -0
  6. package/dist/Prebuilt/components/Chat/ChatFooter.d.ts +7 -0
  7. package/dist/Prebuilt/components/Connection/ConnectionIndicator.d.ts +6 -0
  8. package/dist/Prebuilt/components/Connection/TileConnection.d.ts +10 -0
  9. package/dist/Prebuilt/components/Footer/ChatToggle.d.ts +4 -0
  10. package/dist/Prebuilt/components/Footer/Footer.d.ts +6 -0
  11. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +14 -0
  12. package/dist/Prebuilt/components/Footer/RoleOptions.d.ts +6 -0
  13. package/dist/Prebuilt/components/Header/Header.d.ts +2 -0
  14. package/dist/Prebuilt/components/Header/StreamActions.d.ts +11 -0
  15. package/dist/Prebuilt/components/InsetTile.d.ts +2 -0
  16. package/dist/Prebuilt/components/Leave/DesktopLeaveRoom.d.ts +8 -0
  17. package/dist/Prebuilt/components/Leave/EndSessionContent.d.ts +9 -0
  18. package/dist/Prebuilt/components/Leave/LeaveAtoms.d.ts +2196 -0
  19. package/dist/Prebuilt/components/Leave/LeaveCard.d.ts +11 -0
  20. package/dist/Prebuilt/components/Leave/LeaveRoom.d.ts +5 -0
  21. package/dist/Prebuilt/components/Leave/LeaveSessionContent.d.ts +8 -0
  22. package/dist/Prebuilt/components/Leave/MwebLeaveRoom.d.ts +8 -0
  23. package/dist/Prebuilt/components/MoreSettings/MoreSettings.d.ts +6 -0
  24. package/dist/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.d.ts +6 -0
  25. package/dist/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.d.ts +6 -0
  26. package/dist/Prebuilt/components/Pagination.d.ts +6 -0
  27. package/dist/Prebuilt/components/Preview/PreviewContainer.d.ts +3 -0
  28. package/dist/Prebuilt/components/Preview/PreviewForm.d.ts +10 -0
  29. package/dist/Prebuilt/components/Preview/PreviewJoin.d.ts +16 -0
  30. package/dist/Prebuilt/components/RoleChangeRequestModal.d.ts +2 -0
  31. package/dist/Prebuilt/components/SecondaryTiles.d.ts +3 -0
  32. package/dist/Prebuilt/components/VideoLayouts/EqualProminence.d.ts +3 -0
  33. package/dist/Prebuilt/components/VideoLayouts/Grid.d.ts +6 -0
  34. package/dist/Prebuilt/components/VideoLayouts/GridLayout.d.ts +12 -0
  35. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +15 -0
  36. package/dist/Prebuilt/components/VideoLayouts/RoleProminence.d.ts +3 -0
  37. package/dist/Prebuilt/components/VideoLayouts/ScreenshareLayout.d.ts +3 -0
  38. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +9 -0
  39. package/dist/Prebuilt/components/hooks/useAutoStartStreaming.d.ts +1 -0
  40. package/dist/Prebuilt/components/hooks/useRedirectToLeave.d.ts +3 -0
  41. package/dist/Prebuilt/components/hooks/useRoleProminencePeers.d.ts +5 -0
  42. package/dist/Prebuilt/components/hooks/useTileLayout.d.ts +13 -0
  43. package/dist/Prebuilt/components/hooks/useVideoTileLayout.d.ts +13 -0
  44. package/dist/Prebuilt/layouts/SidePane.d.ts +9 -0
  45. package/dist/Prebuilt/layouts/VideoStreamingSection.d.ts +7 -0
  46. package/dist/Prebuilt/plugins/whiteboard/ToggleWhiteboard.d.ts +5 -0
  47. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.d.ts +1 -0
  48. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.d.ts +1 -0
  49. package/dist/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.d.ts +17 -0
  50. package/dist/Prebuilt/provider/roomLayoutProvider/index.d.ts +6 -1
  51. package/dist/{VirtualBackground-GGCQJ5JM.js → VirtualBackground-UM2FOUHQ.js} +5 -11
  52. package/dist/VirtualBackground-UM2FOUHQ.js.map +7 -0
  53. package/dist/{chunk-P5X32KOD.js → chunk-364HP22I.js} +8 -5
  54. package/dist/chunk-364HP22I.js.map +7 -0
  55. package/dist/{chunk-OSM4QEQG.js → chunk-LYSAET4G.js} +3742 -5462
  56. package/dist/chunk-LYSAET4G.js.map +7 -0
  57. package/dist/chunk-POE7H4IE.js +898 -0
  58. package/dist/chunk-POE7H4IE.js.map +7 -0
  59. package/dist/conference-UWLJHMB2.js +5727 -0
  60. package/dist/conference-UWLJHMB2.js.map +7 -0
  61. package/dist/index.cjs.js +9655 -15326
  62. package/dist/index.cjs.js.map +4 -4
  63. package/dist/index.js +2 -2
  64. package/dist/meta.cjs.json +2513 -3456
  65. package/dist/meta.esbuild.json +2807 -3838
  66. package/package.json +8 -7
  67. package/src/Button/Button.tsx +2 -2
  68. package/src/Prebuilt/App.tsx +58 -53
  69. package/src/Prebuilt/{AppContext.jsx → AppContext.tsx} +11 -3
  70. package/src/Prebuilt/IconButton.jsx +11 -0
  71. package/src/Prebuilt/Prebuilt.stories.tsx +1 -0
  72. package/src/Prebuilt/common/{PeersSorter.js → PeersSorter.ts} +16 -11
  73. package/src/Prebuilt/common/constants.js +4 -114
  74. package/src/Prebuilt/common/hooks.js +34 -1
  75. package/src/Prebuilt/common/utils.js +1 -9
  76. package/src/Prebuilt/components/AppData/AppData.jsx +11 -15
  77. package/src/Prebuilt/components/AppData/useUISettings.js +6 -10
  78. package/src/Prebuilt/components/AudioVideoToggle.jsx +10 -2
  79. package/src/Prebuilt/components/AuthToken.jsx +11 -42
  80. package/src/Prebuilt/components/Chat/Chat.jsx +75 -27
  81. package/src/Prebuilt/components/Chat/ChatBody.jsx +95 -36
  82. package/src/Prebuilt/components/Chat/ChatFooter.tsx +199 -0
  83. package/src/Prebuilt/components/Chat/ChatParticipantHeader.jsx +84 -0
  84. package/src/Prebuilt/components/Chat/ChatSelector.jsx +16 -17
  85. package/src/Prebuilt/components/Chat/ChatSelectorContainer.jsx +81 -0
  86. package/src/Prebuilt/components/Chat/useEmojiPickerStyles.js +5 -4
  87. package/src/Prebuilt/components/Connection/{ConnectionIndicator.jsx → ConnectionIndicator.tsx} +12 -4
  88. package/src/Prebuilt/components/Connection/TileConnection.tsx +71 -0
  89. package/src/Prebuilt/components/EmojiReaction.jsx +19 -22
  90. package/src/Prebuilt/components/Footer/{ChatToggle.jsx → ChatToggle.tsx} +13 -9
  91. package/src/Prebuilt/components/Footer/Footer.tsx +98 -0
  92. package/src/Prebuilt/components/Footer/ParticipantList.jsx +187 -179
  93. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +94 -0
  94. package/src/Prebuilt/components/Footer/RoleOptions.tsx +155 -0
  95. package/src/Prebuilt/components/FullPageProgress.jsx +3 -3
  96. package/src/Prebuilt/components/HMSVideo/Controls.jsx +3 -2
  97. package/src/Prebuilt/components/HMSVideo/HLSQualitySelector.jsx +63 -18
  98. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +2 -2
  99. package/src/Prebuilt/components/HMSVideo/PlayButton.jsx +1 -1
  100. package/src/Prebuilt/components/HMSVideo/VideoProgress.jsx +5 -6
  101. package/src/Prebuilt/components/HMSVideo/VideoTime.jsx +3 -3
  102. package/src/Prebuilt/components/HMSVideo/VolumeControl.jsx +38 -9
  103. package/src/Prebuilt/components/Header/{ConferencingHeader.jsx → Header.tsx} +9 -7
  104. package/src/Prebuilt/components/Header/HeaderComponents.jsx +13 -4
  105. package/src/Prebuilt/components/Header/{StreamActions.jsx → StreamActions.tsx} +54 -67
  106. package/src/Prebuilt/components/Header/common.jsx +5 -2
  107. package/src/Prebuilt/components/Header/index.tsx +1 -0
  108. package/src/Prebuilt/components/IconButtonWithOptions/IconButtonWithOptions.jsx +23 -4
  109. package/src/Prebuilt/components/InsetTile.tsx +128 -0
  110. package/src/Prebuilt/components/{MoreSettings/SplitComponents/DesktopLeaveRoom.jsx → Leave/DesktopLeaveRoom.tsx} +67 -25
  111. package/src/Prebuilt/components/{EndSessionContent.jsx → Leave/EndSessionContent.tsx} +18 -11
  112. package/src/Prebuilt/components/Leave/LeaveAtoms.tsx +26 -0
  113. package/src/Prebuilt/components/Leave/LeaveCard.tsx +36 -0
  114. package/src/Prebuilt/components/Leave/LeaveRoom.tsx +66 -0
  115. package/src/Prebuilt/components/{LeaveSessionContent.jsx → Leave/LeaveSessionContent.tsx} +20 -6
  116. package/src/Prebuilt/components/{MoreSettings/SplitComponents/MwebLeaveRoom.jsx → Leave/MwebLeaveRoom.tsx} +43 -18
  117. package/src/Prebuilt/components/MetaActions.jsx +15 -23
  118. package/src/Prebuilt/components/MoreSettings/ActionTile.jsx +5 -0
  119. package/src/Prebuilt/components/MoreSettings/ChangeNameContent.jsx +16 -7
  120. package/src/Prebuilt/components/MoreSettings/ChangeNameModal.jsx +1 -1
  121. package/src/Prebuilt/components/MoreSettings/FullScreenItem.jsx +1 -4
  122. package/src/Prebuilt/components/MoreSettings/MoreSettings.tsx +27 -0
  123. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +216 -0
  124. package/src/Prebuilt/components/MoreSettings/SplitComponents/{MwebOptions.jsx → MwebOptions.tsx} +107 -45
  125. package/src/Prebuilt/components/Notifications/HLSFailureModal.jsx +3 -1
  126. package/src/Prebuilt/components/Notifications/Notifications.jsx +46 -30
  127. package/src/Prebuilt/components/Notifications/PeerNotifications.jsx +14 -2
  128. package/src/Prebuilt/components/Notifications/PermissionErrorModal.jsx +10 -4
  129. package/src/Prebuilt/components/Notifications/ReconnectNotifications.jsx +5 -11
  130. package/src/Prebuilt/components/PIP/PIPComponent.jsx +7 -16
  131. package/src/Prebuilt/components/PIP/PIPManager.js +1 -0
  132. package/src/Prebuilt/components/Pagination.tsx +60 -0
  133. package/src/Prebuilt/components/Playlist/Playlist.jsx +1 -6
  134. package/src/Prebuilt/components/PostLeave.jsx +7 -7
  135. package/src/Prebuilt/components/Preview/{PreviewContainer.jsx → PreviewContainer.tsx} +16 -15
  136. package/src/Prebuilt/components/Preview/{PreviewForm.jsx → PreviewForm.tsx} +16 -8
  137. package/src/Prebuilt/components/Preview/{PreviewJoin.jsx → PreviewJoin.tsx} +48 -22
  138. package/src/Prebuilt/components/RaiseHand.jsx +0 -7
  139. package/src/Prebuilt/components/RoleChangeRequestModal.tsx +119 -0
  140. package/src/Prebuilt/components/ScreenshareDisplay.jsx +4 -10
  141. package/src/Prebuilt/components/ScreenshareTile.jsx +43 -36
  142. package/src/Prebuilt/components/SecondaryTiles.tsx +36 -0
  143. package/src/Prebuilt/components/Settings/LayoutSettings.jsx +2 -12
  144. package/src/Prebuilt/components/Settings/NotificationSettings.jsx +3 -9
  145. package/src/Prebuilt/components/Settings/SettingsModal.jsx +3 -9
  146. package/src/Prebuilt/components/StatsForNerds.jsx +3 -1
  147. package/src/Prebuilt/components/TileMenu/TileMenu.jsx +16 -17
  148. package/src/Prebuilt/components/TileMenu/TileMenuContent.jsx +33 -27
  149. package/src/Prebuilt/components/Toast/ToastConfig.jsx +58 -15
  150. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +65 -0
  151. package/src/Prebuilt/components/VideoLayouts/Grid.tsx +43 -0
  152. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +110 -0
  153. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +74 -0
  154. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +59 -0
  155. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +52 -0
  156. package/src/Prebuilt/components/VideoLayouts/interface.ts +10 -0
  157. package/src/Prebuilt/components/VideoTile.jsx +116 -74
  158. package/src/Prebuilt/components/conference.jsx +86 -85
  159. package/src/Prebuilt/components/hooks/useAutoStartStreaming.tsx +57 -0
  160. package/src/Prebuilt/components/hooks/useMetadata.jsx +19 -3
  161. package/src/Prebuilt/components/hooks/useRedirectToLeave.tsx +34 -0
  162. package/src/Prebuilt/components/hooks/useRoleProminencePeers.tsx +38 -0
  163. package/src/Prebuilt/components/hooks/useTileLayout.tsx +127 -0
  164. package/src/Prebuilt/components/hooks/useVideoTileLayout.ts +26 -0
  165. package/src/Prebuilt/components/pdfAnnotator/pdfFileOptions.jsx +5 -72
  166. package/src/Prebuilt/components/pdfAnnotator/submitPdf.jsx +4 -45
  167. package/src/Prebuilt/components/pdfAnnotator/uploadedFile.jsx +2 -17
  168. package/src/Prebuilt/components/peerTileUtils.jsx +1 -1
  169. package/src/Prebuilt/images/empty-chat.svg +12 -0
  170. package/src/Prebuilt/layouts/EmbedView.jsx +17 -50
  171. package/src/Prebuilt/layouts/HLSView.jsx +138 -51
  172. package/src/Prebuilt/layouts/PDFView.jsx +1 -11
  173. package/src/Prebuilt/layouts/SidePane.tsx +108 -0
  174. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +96 -0
  175. package/src/Prebuilt/layouts/WhiteboardView.jsx +10 -34
  176. package/src/Prebuilt/plugins/FlyingEmoji.jsx +14 -2
  177. package/src/Prebuilt/plugins/VirtualBackground/VirtualBackground.jsx +1 -4
  178. package/src/Prebuilt/plugins/whiteboard/{ToggleWhiteboard.jsx → ToggleWhiteboard.tsx} +5 -9
  179. package/src/Prebuilt/primitives/DialogContent.jsx +15 -11
  180. package/src/Prebuilt/provider/roomLayoutProvider/constants/index.ts +17 -2
  181. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useFetchRoomLayout.ts +36 -13
  182. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useInsetEnabled.ts +10 -0
  183. package/src/Prebuilt/provider/roomLayoutProvider/hooks/useRoomLayoutScreen.ts +65 -0
  184. package/src/Prebuilt/provider/roomLayoutProvider/index.tsx +17 -6
  185. package/src/Prebuilt/services/FeatureFlags.jsx +0 -1
  186. package/src/VideoTile/StyledVideoTile.tsx +1 -0
  187. package/dist/HLSView-P57IRMAR.js.map +0 -7
  188. package/dist/PinnedTrackView-4FYJEBTB.js +0 -102
  189. package/dist/PinnedTrackView-4FYJEBTB.js.map +0 -7
  190. package/dist/VirtualBackground-GGCQJ5JM.js.map +0 -7
  191. package/dist/chunk-IVTWKQI3.js +0 -827
  192. package/dist/chunk-IVTWKQI3.js.map +0 -7
  193. package/dist/chunk-OSM4QEQG.js.map +0 -7
  194. package/dist/chunk-P5X32KOD.js.map +0 -7
  195. package/dist/chunk-RVCZPPTL.js +0 -1100
  196. package/dist/chunk-RVCZPPTL.js.map +0 -7
  197. package/dist/conference-P6I6ESVF.js +0 -8995
  198. package/dist/conference-P6I6ESVF.js.map +0 -7
  199. package/src/Prebuilt/components/AudioLevel/BeamSpeakerLabelsLogging.jsx +0 -16
  200. package/src/Prebuilt/components/Chat/ChatFooter.jsx +0 -150
  201. package/src/Prebuilt/components/Chat/ChatHeader.jsx +0 -67
  202. package/src/Prebuilt/components/Connection/TileConnection.jsx +0 -39
  203. package/src/Prebuilt/components/EqualProminence.jsx +0 -180
  204. package/src/Prebuilt/components/FirstPersonDisplay.jsx +0 -50
  205. package/src/Prebuilt/components/Footer/Footer.jsx +0 -73
  206. package/src/Prebuilt/components/Header/Header.jsx +0 -8
  207. package/src/Prebuilt/components/Header/StreamingHeader.jsx +0 -54
  208. package/src/Prebuilt/components/LeaveCard.jsx +0 -19
  209. package/src/Prebuilt/components/LeaveRoom.jsx +0 -94
  210. package/src/Prebuilt/components/MoreSettings/MoreSettings.jsx +0 -10
  211. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.jsx +0 -219
  212. package/src/Prebuilt/components/Notifications/MessageNotifications.jsx +0 -25
  213. package/src/Prebuilt/components/Pagination.jsx +0 -29
  214. package/src/Prebuilt/components/RoleChangeRequestModal.jsx +0 -26
  215. package/src/Prebuilt/components/VideoList.jsx +0 -73
  216. package/src/Prebuilt/components/gridView.jsx +0 -85
  217. package/src/Prebuilt/components/hooks/useFeatures.js +0 -22
  218. package/src/Prebuilt/components/hooks/useNavigation.js +0 -19
  219. package/src/Prebuilt/components/hooks/useSkipPreview.jsx +0 -20
  220. package/src/Prebuilt/components/pdfAnnotator/pdfErrorView.jsx +0 -29
  221. package/src/Prebuilt/images/Logo.svg +0 -8
  222. package/src/Prebuilt/layouts/ActiveSpeakerView.jsx +0 -34
  223. package/src/Prebuilt/layouts/InsetView.jsx +0 -260
  224. package/src/Prebuilt/layouts/PinnedTrackView.jsx +0 -59
  225. package/src/Prebuilt/layouts/SidePane.jsx +0 -52
  226. package/src/Prebuilt/layouts/mainGridView.jsx +0 -98
  227. package/src/Prebuilt/layouts/mainView.jsx +0 -141
  228. package/src/Prebuilt/layouts/screenShareView.jsx +0 -183
  229. /package/{src/Prebuilt/components/Header/index.jsx → dist/Prebuilt/components/Header/index.d.ts} +0 -0
  230. /package/src/Prebuilt/components/{ScreenShare.jsx → ScreenShareToggle.jsx} +0 -0
  231. /package/src/{assets → Prebuilt/images}/android-perm-1.png +0 -0
  232. /package/src/{assets → Prebuilt/images}/ios-perm-0.png +0 -0
@@ -1,5 +1,6 @@
1
- import React, { Fragment, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
1
+ import React, { Fragment, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
2
2
  import { useInView } from 'react-intersection-observer';
3
+ import { useMedia } from 'react-use';
3
4
  import AutoSizer from 'react-virtualized-auto-sizer';
4
5
  import { VariableSizeList } from 'react-window';
5
6
  import {
@@ -13,13 +14,15 @@ import {
13
14
  useHMSActions,
14
15
  useHMSStore,
15
16
  } from '@100mslive/react-sdk';
16
- import { HorizontalMenuIcon, PinIcon } from '@100mslive/react-icons';
17
+ import { PinIcon, VerticalMenuIcon } from '@100mslive/react-icons';
17
18
  import { Dropdown } from '../../../Dropdown';
18
19
  import { IconButton } from '../../../IconButton';
19
20
  import { Box, Flex } from '../../../Layout';
20
21
  import { Text } from '../../../Text';
21
- import { styled } from '../../../Theme';
22
+ import { config as cssConfig, styled } from '../../../Theme';
22
23
  import { Tooltip } from '../../../Tooltip';
24
+ import emptyChat from '../../images/empty-chat.svg';
25
+ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
23
26
  import { useSetPinnedMessage } from '../hooks/useSetPinnedMessage';
24
27
 
25
28
  const formatTime = date => {
@@ -46,7 +49,7 @@ const MessageTypeContainer = ({ left, right }) => {
46
49
  ml: 'auto',
47
50
  mr: '$4',
48
51
  p: '$2 $4',
49
- border: '1px solid $on_surface_low',
52
+ border: '1px solid $border_bright',
50
53
  r: '$0',
51
54
  }}
52
55
  >
@@ -55,9 +58,9 @@ const MessageTypeContainer = ({ left, right }) => {
55
58
  {left}
56
59
  </SenderName>
57
60
  )}
58
- {left && right && <Box css={{ borderLeft: '1px solid $on_surface_low', mx: '$4', h: '$8' }} />}
61
+ {left && right && <Box css={{ borderLeft: '1px solid $border_bright', mx: '$4', h: '$8' }} />}
59
62
  {right && (
60
- <SenderName as="span" variant="tiny">
63
+ <SenderName as="span" variant="tiny" css={{ textTransform: 'uppercase' }}>
61
64
  {right}
62
65
  </SenderName>
63
66
  )}
@@ -123,16 +126,18 @@ const getMessageType = ({ roles, receiver }) => {
123
126
  }
124
127
  return receiver ? 'private' : '';
125
128
  };
126
-
127
- const ChatActions = ({ onPin }) => {
129
+ const ChatActions = ({ onPin, showPinAction }) => {
128
130
  const [open, setOpen] = useState(false);
131
+ if (!showPinAction) {
132
+ return null;
133
+ }
129
134
 
130
135
  return (
131
136
  <Dropdown.Root open={open} onOpenChange={setOpen}>
132
- <Dropdown.Trigger asChild>
137
+ <Dropdown.Trigger className="chat_actions" css={{ opacity: open ? 1 : 0, '@md': { opacity: 1 } }} asChild>
133
138
  <IconButton>
134
139
  <Tooltip title="More options">
135
- <HorizontalMenuIcon />
140
+ <VerticalMenuIcon />
136
141
  </Tooltip>
137
142
  </IconButton>
138
143
  </Dropdown.Trigger>
@@ -140,7 +145,7 @@ const ChatActions = ({ onPin }) => {
140
145
  <Dropdown.Content
141
146
  sideOffset={5}
142
147
  align="end"
143
- css={{ width: '$48', backgroundColor: '$surface_bright', py: '$0' }}
148
+ css={{ width: '$48', backgroundColor: '$surface_bright', py: '$0', border: '1px solid $border_bright' }}
144
149
  >
145
150
  <Dropdown.Item data-testid="pin_message_btn" onClick={onPin}>
146
151
  <PinIcon />
@@ -148,6 +153,29 @@ const ChatActions = ({ onPin }) => {
148
153
  Pin Message
149
154
  </Text>
150
155
  </Dropdown.Item>
156
+ {/* {isMobile ? (
157
+ <Dropdown.Item
158
+ data-testid="copy_message_btn"
159
+ onClick={() => {
160
+ try {
161
+ navigator?.clipboard.writeText(messageContent);
162
+ ToastManager.addToast({
163
+ title: 'Message copied successfully',
164
+ });
165
+ } catch (e) {
166
+ console.log(e);
167
+ ToastManager.addToast({
168
+ title: 'Could not copy message',
169
+ });
170
+ }
171
+ }}
172
+ >
173
+ <CopyIcon />
174
+ <Text variant="sm" css={{ ml: '$4' }}>
175
+ Copy Message
176
+ </Text>
177
+ </Dropdown.Item>
178
+ ) : null} */}
151
179
  </Dropdown.Content>
152
180
  </Dropdown.Portal>
153
181
  </Dropdown.Root>
@@ -160,6 +188,8 @@ const SenderName = styled(Text, {
160
188
  whiteSpace: 'nowrap',
161
189
  maxWidth: '24ch',
162
190
  minWidth: 0,
191
+ color: '$on_surface_high',
192
+ fontWeight: '$semiBold',
163
193
  });
164
194
 
165
195
  const ChatMessage = React.memo(({ index, style = {}, message, setRowHeight, onPin }) => {
@@ -170,7 +200,9 @@ const ChatMessage = React.memo(({ index, style = {}, message, setRowHeight, onPi
170
200
  setRowHeight(index, rowRef.current.clientHeight);
171
201
  }
172
202
  }, [index, setRowHeight]);
173
-
203
+ const isMobile = useMedia(cssConfig.media.md);
204
+ const { elements } = useRoomLayoutConferencingScreen();
205
+ const isOverlay = elements?.chat?.is_overlay && isMobile;
174
206
  const hmsActions = useHMSActions();
175
207
  const localPeerId = useHMSStore(selectLocalPeerID);
176
208
  const permissions = useHMSStore(selectPermissions);
@@ -179,7 +211,7 @@ const ChatMessage = React.memo(({ index, style = {}, message, setRowHeight, onPi
179
211
  receiver: message.recipientPeer,
180
212
  });
181
213
  // show pin action only if peer has remove others permission and the message is of broadcast type
182
- const showPinAction = permissions.removeOthers && !messageType;
214
+ const showPinAction = permissions.removeOthers && !messageType && elements?.chat?.allow_pinning_messages;
183
215
 
184
216
  useEffect(() => {
185
217
  if (message.id && !message.read && inView) {
@@ -188,13 +220,19 @@ const ChatMessage = React.memo(({ index, style = {}, message, setRowHeight, onPi
188
220
  }, [message.read, hmsActions, inView, message.id]);
189
221
 
190
222
  return (
191
- <Box ref={ref} as="div" css={{ mb: '$10', pr: '$10' }} style={style}>
223
+ <Box
224
+ ref={ref}
225
+ as="div"
226
+ css={{ mb: '$10', pr: '$10', mt: '$8', '&:hover .chat_actions': { opacity: 1 } }}
227
+ style={style}
228
+ >
192
229
  <Flex
193
230
  ref={rowRef}
194
231
  align="center"
195
232
  css={{
196
233
  flexWrap: 'wrap',
197
- bg: messageType ? '$surface_bright' : undefined,
234
+ // Theme independent color, token should not be used for transparent chat
235
+ bg: messageType ? (isOverlay ? 'rgba(0, 0, 0, 0.64)' : '$surface_default') : undefined,
198
236
  r: messageType ? '$1' : undefined,
199
237
  px: messageType ? '$4' : '$2',
200
238
  py: messageType ? '$4' : 0,
@@ -205,7 +243,7 @@ const ChatMessage = React.memo(({ index, style = {}, message, setRowHeight, onPi
205
243
  >
206
244
  <Text
207
245
  css={{
208
- color: '$on_surface_high',
246
+ color: isOverlay ? '#FFF' : '$on_surface_high',
209
247
  fontWeight: '$semiBold',
210
248
  display: 'inline-flex',
211
249
  alignItems: 'center',
@@ -214,41 +252,48 @@ const ChatMessage = React.memo(({ index, style = {}, message, setRowHeight, onPi
214
252
  }}
215
253
  as="div"
216
254
  >
217
- <Flex align="center">
255
+ <Flex align="baseline">
218
256
  {message.senderName === 'You' || !message.senderName ? (
219
- <SenderName as="span">{message.senderName || 'Anonymous'}</SenderName>
257
+ <SenderName as="span" variant="sm" css={{ color: isOverlay ? '#FFF' : '$on_surface_high' }}>
258
+ {message.senderName || 'Anonymous'}
259
+ </SenderName>
220
260
  ) : (
221
261
  <Tooltip title={message.senderName} side="top" align="start">
222
- <SenderName as="span">{message.senderName}</SenderName>
262
+ <SenderName as="span" variant="sm" css={{ color: isOverlay ? '#FFF' : '$on_surface_high' }}>
263
+ {message.senderName}
264
+ </SenderName>
223
265
  </Tooltip>
224
266
  )}
225
- <Text
226
- as="span"
227
- variant="sm"
228
- css={{
229
- ml: '$4',
230
- color: '$on_primary_medium',
231
- flexShrink: 0,
232
- }}
233
- >
234
- {formatTime(message.time)}
235
- </Text>
267
+ {!isOverlay ? (
268
+ <Text
269
+ as="span"
270
+ variant="xs"
271
+ css={{
272
+ ml: '$4',
273
+ color: '$on_surface_medium',
274
+ flexShrink: 0,
275
+ }}
276
+ >
277
+ {formatTime(message.time)}
278
+ </Text>
279
+ ) : null}
236
280
  </Flex>
237
281
  <MessageType
238
282
  hasCurrentUserSent={message.sender === localPeerId}
239
283
  receiver={message.recipientPeer}
240
284
  roles={message.recipientRoles}
241
285
  />
242
- {showPinAction && <ChatActions onPin={onPin} />}
286
+ {!isOverlay ? <ChatActions onPin={onPin} showPinAction={showPinAction} /> : null}
243
287
  </Text>
244
288
  <Text
245
- variant="body2"
289
+ variant="sm"
246
290
  css={{
247
291
  w: '100%',
248
292
  mt: '$2',
249
293
  wordBreak: 'break-word',
250
294
  whiteSpace: 'pre-wrap',
251
295
  userSelect: 'all',
296
+ color: isOverlay ? '#FFF' : '$on_surface_high',
252
297
  }}
253
298
  onClick={e => e.stopPropagation()}
254
299
  >
@@ -345,21 +390,35 @@ export const ChatBody = React.forwardRef(({ role, peerId, scrollToBottom }, list
345
390
  : peerId
346
391
  ? selectMessagesByPeerID(peerId)
347
392
  : selectHMSMessages;
348
- const messages = useHMSStore(storeMessageSelector) || [];
393
+ let messages = useHMSStore(storeMessageSelector);
394
+ messages = useMemo(() => messages?.filter(message => message.type === 'chat') || [], [messages]);
395
+ const isMobile = useMedia(cssConfig.media.md);
396
+ const { elements } = useRoomLayoutConferencingScreen();
349
397
 
350
- if (messages.length === 0) {
398
+ if (messages.length === 0 && !(isMobile && elements?.chat?.is_overlay)) {
351
399
  return (
352
400
  <Flex
353
401
  css={{
354
402
  width: '100%',
355
- height: '100%',
403
+ flex: '1 1 0',
356
404
  textAlign: 'center',
357
405
  px: '$4',
358
406
  }}
359
407
  align="center"
360
408
  justify="center"
361
409
  >
362
- <Text>There are no messages here</Text>
410
+ <Box>
411
+ <img src={emptyChat} alt="Empty Chat" height={132} width={185} style={{ margin: '0 auto' }} />
412
+ <Text variant="h5" css={{ mt: '$8', c: '$on_surface_high' }}>
413
+ Start a conversation
414
+ </Text>
415
+ <Text
416
+ variant="sm"
417
+ css={{ mt: '$4', maxWidth: '80%', textAlign: 'center', mx: 'auto', c: '$on_surface_medium' }}
418
+ >
419
+ There are no messages here yet. Start a conversation by sending a message.
420
+ </Text>
421
+ </Box>
363
422
  </Flex>
364
423
  );
365
424
  }
@@ -0,0 +1,199 @@
1
+ import React, { ReactNode, useCallback, useEffect, useRef, useState } from 'react';
2
+ import { useMedia } from 'react-use';
3
+ import data from '@emoji-mart/data';
4
+ import Picker from '@emoji-mart/react';
5
+ import { useHMSActions } from '@100mslive/react-sdk';
6
+ import { EmojiIcon, SendIcon } from '@100mslive/react-icons';
7
+ import { Box, config as cssConfig, Flex, IconButton as BaseIconButton, Popover, styled } from '../../..';
8
+ // @ts-ignore
9
+ import { ToastManager } from '../Toast/ToastManager';
10
+ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
11
+ // import { ChatSelectorContainer } from './ChatSelectorContainer';
12
+ // @ts-ignore
13
+ import { useChatDraftMessage } from '../AppData/useChatState';
14
+ // @ts-ignore
15
+ import { useEmojiPickerStyles } from './useEmojiPickerStyles';
16
+
17
+ const TextArea = styled('textarea', {
18
+ width: '100%',
19
+ bg: 'transparent',
20
+ color: '$on_primary_high',
21
+ resize: 'none',
22
+ lineHeight: '1rem',
23
+ position: 'relative',
24
+ fontFamily: '$sans',
25
+ fontSize: '100%',
26
+ margin: 0,
27
+ padding: 0,
28
+ top: '$3',
29
+ '&:focus': {
30
+ boxShadow: 'none',
31
+ outline: 'none',
32
+ },
33
+ });
34
+
35
+ function EmojiPicker({ onSelect }: { onSelect: (emoji: any) => void }) {
36
+ const [showEmoji, setShowEmoji] = useState(false);
37
+ const ref = useEmojiPickerStyles(showEmoji);
38
+ return (
39
+ <Popover.Root open={showEmoji} onOpenChange={setShowEmoji}>
40
+ <Popover.Trigger asChild css={{ appearance: 'none' }}>
41
+ <BaseIconButton as="div">
42
+ <EmojiIcon />
43
+ </BaseIconButton>
44
+ </Popover.Trigger>
45
+ <Popover.Portal>
46
+ <Popover.Content
47
+ alignOffset={-40}
48
+ sideOffset={16}
49
+ align="end"
50
+ css={{
51
+ p: 0,
52
+ }}
53
+ >
54
+ <Box
55
+ css={{
56
+ minWidth: 352,
57
+ minHeight: 435,
58
+ }}
59
+ ref={ref}
60
+ >
61
+ <Picker onEmojiSelect={onSelect} data={data} previewPosition="none" skinPosition="search" />
62
+ </Box>
63
+ </Popover.Content>
64
+ </Popover.Portal>
65
+ </Popover.Root>
66
+ );
67
+ }
68
+
69
+ export const ChatFooter = ({
70
+ role,
71
+ peerId,
72
+ onSend,
73
+ children /* onSelect, selection, screenType */,
74
+ }: {
75
+ role: any;
76
+ peerId: string;
77
+ onSend: any;
78
+ children: ReactNode;
79
+ }) => {
80
+ const hmsActions = useHMSActions();
81
+ const inputRef = useRef<HTMLTextAreaElement>(null);
82
+ const [draftMessage, setDraftMessage] = useChatDraftMessage();
83
+ const isMobile = useMedia(cssConfig.media.md);
84
+ const { elements } = useRoomLayoutConferencingScreen();
85
+ const isOverlayChat = elements?.chat?.is_overlay;
86
+
87
+ const sendMessage = useCallback(async () => {
88
+ const message = inputRef?.current?.value;
89
+ if (!message || !message.trim().length) {
90
+ return;
91
+ }
92
+ try {
93
+ if (role) {
94
+ await hmsActions.sendGroupMessage(message, [role]);
95
+ } else if (peerId) {
96
+ await hmsActions.sendDirectMessage(message, peerId);
97
+ } else {
98
+ await hmsActions.sendBroadcastMessage(message);
99
+ }
100
+ inputRef.current.value = '';
101
+ setTimeout(() => {
102
+ onSend();
103
+ }, 0);
104
+ } catch (error) {
105
+ const err = error as Error;
106
+ ToastManager.addToast({ title: err.message });
107
+ }
108
+ }, [role, peerId, hmsActions, onSend]);
109
+
110
+ useEffect(() => {
111
+ const messageElement = inputRef.current;
112
+ if (messageElement) {
113
+ messageElement.value = draftMessage;
114
+ }
115
+ }, [draftMessage]);
116
+
117
+ useEffect(() => {
118
+ const messageElement = inputRef.current;
119
+ return () => {
120
+ setDraftMessage(messageElement?.value || '');
121
+ };
122
+ }, [setDraftMessage]);
123
+
124
+ return (
125
+ <>
126
+ {/* {screenType !== 'hls_live_streaming' ? (
127
+ <ChatSelectorContainer onSelect={onSelect} role={role} peerId={peerId} selection={selection} />
128
+ ) : null} */}
129
+ <Flex align="center" css={{ gap: '$4', w: '100%' }}>
130
+ <Flex
131
+ align="center"
132
+ css={{
133
+ bg: isOverlayChat && isMobile ? '$surface_dim' : '$surface_default',
134
+ minHeight: '$16',
135
+ maxHeight: '$24',
136
+ position: 'relative',
137
+ py: '$6',
138
+ pl: '$8',
139
+ flexGrow: 1,
140
+ r: '$1',
141
+ '@md': {
142
+ minHeight: 'unset',
143
+ h: '$14',
144
+ boxSizing: 'border-box',
145
+ },
146
+ }}
147
+ >
148
+ {children}
149
+ <TextArea
150
+ css={{
151
+ c: '$on_surface_high',
152
+ '&:valid ~ .send-msg': { color: '$on_surface_high' },
153
+ '& ~ .send-msg': { color: '$on_surface_low' },
154
+ }}
155
+ placeholder="Send a message...."
156
+ ref={inputRef}
157
+ required
158
+ autoFocus={!isMobile}
159
+ onKeyPress={async event => {
160
+ if (event.key === 'Enter') {
161
+ if (!event.shiftKey) {
162
+ event.preventDefault();
163
+ await sendMessage();
164
+ }
165
+ }
166
+ }}
167
+ autoComplete="off"
168
+ aria-autocomplete="none"
169
+ onPaste={e => e.stopPropagation()}
170
+ onCut={e => e.stopPropagation()}
171
+ onCopy={e => e.stopPropagation()}
172
+ />
173
+ {!isMobile ? (
174
+ <EmojiPicker
175
+ onSelect={(emoji: any) => {
176
+ if (inputRef.current) {
177
+ inputRef.current.value += ` ${emoji.native} `;
178
+ }
179
+ }}
180
+ />
181
+ ) : null}
182
+ <BaseIconButton
183
+ className="send-msg"
184
+ onClick={sendMessage}
185
+ css={{
186
+ ml: 'auto',
187
+ height: 'max-content',
188
+ mr: '$4',
189
+ '&:hover': { c: isMobile ? '' : '$on_surface_medium' },
190
+ }}
191
+ data-testid="send_msg_btn"
192
+ >
193
+ <SendIcon />
194
+ </BaseIconButton>
195
+ </Flex>
196
+ </Flex>
197
+ </>
198
+ );
199
+ };
@@ -0,0 +1,84 @@
1
+ import React, { useState } from 'react';
2
+ import { selectPeerCount, useHMSStore } from '@100mslive/react-sdk';
3
+ import { CrossIcon } from '@100mslive/react-icons';
4
+ import { Flex, IconButton, Tabs, Text } from '../../..';
5
+ import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
6
+ import { useSidepaneToggle } from '../AppData/useSidepane';
7
+ import { SIDE_PANE_OPTIONS } from '../../common/constants';
8
+
9
+ const tabTriggerCSS = {
10
+ color: '$on_surface_high',
11
+ p: '$4',
12
+ fontWeight: '$semiBold',
13
+ fontSize: '$sm',
14
+ w: '100%',
15
+ justifyContent: 'center',
16
+ };
17
+
18
+ export const ChatParticipantHeader = React.memo(({ activeTabValue = SIDE_PANE_OPTIONS.CHAT }) => {
19
+ const toggleChat = useSidepaneToggle(SIDE_PANE_OPTIONS.CHAT);
20
+ const toggleParticipants = useSidepaneToggle(SIDE_PANE_OPTIONS.PARTICIPANTS);
21
+ const [activeTab, setActiveTab] = useState(activeTabValue);
22
+ const peerCount = useHMSStore(selectPeerCount);
23
+ const { elements } = useRoomLayoutConferencingScreen();
24
+ const showChat = !!elements?.chat;
25
+ const showParticipants = !!elements?.participant_list;
26
+ const hideTabs = !(showChat && showParticipants);
27
+
28
+ return (
29
+ <Flex
30
+ align="center"
31
+ css={{
32
+ color: '$on_primary_high',
33
+ h: '$16',
34
+ }}
35
+ >
36
+ {hideTabs ? (
37
+ <Text variant="sm" css={{ fontWeight: '$semiBold', c: '$on_surface_high' }}>
38
+ {showChat ? 'Chat' : `Participants (${peerCount})`}
39
+ </Text>
40
+ ) : (
41
+ <Flex css={{ w: '100%', bg: '$surface_default', borderRadius: '$2' }}>
42
+ <Tabs.Root value={activeTab} onValueChange={setActiveTab} css={{ w: '100%' }}>
43
+ <Tabs.List css={{ w: '100%', p: '$2' }}>
44
+ <Tabs.Trigger
45
+ value={SIDE_PANE_OPTIONS.CHAT}
46
+ onClick={toggleChat}
47
+ css={{
48
+ ...tabTriggerCSS,
49
+ color: activeTab !== SIDE_PANE_OPTIONS.CHAT ? '$on_surface_low' : '$on_surface_high',
50
+ }}
51
+ >
52
+ Chat
53
+ </Tabs.Trigger>
54
+ <Tabs.Trigger
55
+ value={SIDE_PANE_OPTIONS.PARTICIPANTS}
56
+ onClick={toggleParticipants}
57
+ css={{
58
+ ...tabTriggerCSS,
59
+ color: activeTab !== SIDE_PANE_OPTIONS.PARTICIPANTS ? '$on_surface_low' : '$on_surface_high',
60
+ }}
61
+ >
62
+ Participants ({peerCount})
63
+ </Tabs.Trigger>
64
+ </Tabs.List>
65
+ </Tabs.Root>
66
+ </Flex>
67
+ )}
68
+ <IconButton
69
+ css={{ ml: 'auto' }}
70
+ onClick={e => {
71
+ e.stopPropagation();
72
+ if (activeTab === SIDE_PANE_OPTIONS.CHAT) {
73
+ toggleChat();
74
+ } else {
75
+ toggleParticipants();
76
+ }
77
+ }}
78
+ data-testid="close_chat"
79
+ >
80
+ <CrossIcon />
81
+ </IconButton>
82
+ </Flex>
83
+ );
84
+ });
@@ -1,6 +1,4 @@
1
- import React, { Fragment, useMemo, useState } from 'react';
2
- import { useMeasure } from 'react-use';
3
- import { FixedSizeList } from 'react-window';
1
+ import React, { useMemo, useState } from 'react';
4
2
  import {
5
3
  selectMessagesUnreadCountByPeerID,
6
4
  selectMessagesUnreadCountByRole,
@@ -19,7 +17,11 @@ const ChatDotIcon = () => {
19
17
 
20
18
  const SelectorItem = ({ value, active, onClick, unreadCount }) => {
21
19
  return (
22
- <Dropdown.Item data-testid="chat_members" css={{ align: 'center', px: '$10' }} onClick={onClick}>
20
+ <Dropdown.Item
21
+ data-testid="chat_members"
22
+ css={{ align: 'center', px: '$10', bg: '$surface_default' }}
23
+ onClick={onClick}
24
+ >
23
25
  <Text variant="sm">{value}</Text>
24
26
  <Flex align="center" css={{ ml: 'auto', color: '$on_primary_high' }}>
25
27
  {unreadCount > 0 && (
@@ -89,7 +91,6 @@ const PeerItem = ({ onSelect, peerId, name, active }) => {
89
91
  };
90
92
 
91
93
  const VirtualizedSelectItemList = ({ peers, selectedRole, selectedPeerId, searchValue, onSelect }) => {
92
- const [ref, { width, height }] = useMeasure();
93
94
  const roles = useFilteredRoles();
94
95
  const filteredPeers = useMemo(
95
96
  () =>
@@ -127,14 +128,12 @@ const VirtualizedSelectItemList = ({ peers, selectedRole, selectedPeerId, search
127
128
  }, [onSelect, selectedRole, selectedPeerId, roles, filteredPeers]);
128
129
 
129
130
  return (
130
- <Dropdown.Group ref={ref} css={{ height: '$64', overflowY: 'auto' }}>
131
- <FixedSizeList itemSize={52} itemCount={listItems.length} width={width} height={height}>
132
- {({ index, style }) => (
133
- <div style={style} key={index}>
134
- {listItems[index]}
135
- </div>
136
- )}
137
- </FixedSizeList>
131
+ <Dropdown.Group css={{ overflowY: 'auto', maxHeight: '$64', bg: '$surface_default' }}>
132
+ <Box>
133
+ {listItems.map((item, index) => (
134
+ <Box key={index}>{item}</Box>
135
+ ))}
136
+ </Box>
138
137
  </Dropdown.Group>
139
138
  );
140
139
  };
@@ -144,10 +143,10 @@ export const ChatSelector = ({ role, peerId, onSelect }) => {
144
143
  const [search, setSearch] = useState('');
145
144
 
146
145
  return (
147
- <Fragment>
146
+ <>
148
147
  {peers.length > 0 && (
149
- <Box css={{ px: '$8' }}>
150
- <ParticipantSearch onSearch={setSearch} placeholder="Search participants" />
148
+ <Box css={{ px: '$4' }}>
149
+ <ParticipantSearch onSearch={setSearch} placeholder="Search for participants" />
151
150
  </Box>
152
151
  )}
153
152
  <VirtualizedSelectItemList
@@ -157,6 +156,6 @@ export const ChatSelector = ({ role, peerId, onSelect }) => {
157
156
  peers={peers}
158
157
  searchValue={search}
159
158
  />
160
- </Fragment>
159
+ </>
161
160
  );
162
161
  };