@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,33 +1,35 @@
1
- import React, { Fragment, useState } from 'react';
1
+ import React from 'react';
2
2
  import { useParams } from 'react-router-dom';
3
+ import { useMedia } from 'react-use';
3
4
  import { selectIsConnectedToRoom, selectPermissions, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
4
- import { AlertTriangleIcon, ExitIcon, HangUpIcon, VerticalMenuIcon } from '@100mslive/react-icons';
5
+ import { DesktopLeaveRoom } from './MoreSettings/SplitComponents/DesktopLeaveRoom';
6
+ import { MwebLeaveRoom } from './MoreSettings/SplitComponents/MwebLeaveRoom';
7
+ import { PictureInPicture } from './PIP/PIPManager';
5
8
  import { ToastManager } from './Toast/ToastManager';
6
- import { Button } from '../../Button';
7
- import { Dropdown } from '../../Dropdown';
8
9
  import { IconButton } from '../../IconButton';
9
- import { Box, Flex } from '../../Layout';
10
- import { Dialog } from '../../Modal';
11
- import { Text } from '../../Text';
12
- import { styled } from '../../Theme';
13
- import { Tooltip } from '../../Tooltip';
10
+ import { config as cssConfig, styled } from '../../Theme';
14
11
  import { useHMSPrebuiltContext } from '../AppContext';
15
- import { DialogCheckbox, DialogContent, DialogRow } from '../primitives/DialogContent';
16
- import { useDropdownList } from './hooks/useDropdownList';
17
12
  import { useNavigation } from './hooks/useNavigation';
18
- import { isStreamingKit } from '../common/utils';
19
13
 
20
14
  export const LeaveRoom = () => {
21
15
  const navigate = useNavigation();
22
16
  const params = useParams();
23
- const [open, setOpen] = useState(false);
24
- const [showEndRoomModal, setShowEndRoomModal] = useState(false);
25
- const [lockRoom, setLockRoom] = useState(false);
26
17
  const isConnected = useHMSStore(selectIsConnectedToRoom);
27
18
  const permissions = useHMSStore(selectPermissions);
19
+ const isMobile = useMedia(cssConfig.media.md);
28
20
  const hmsActions = useHMSActions();
29
21
  const { showLeave, onLeave } = useHMSPrebuiltContext();
30
- useDropdownList({ open, name: 'LeaveRoom' });
22
+
23
+ const stopStream = async () => {
24
+ try {
25
+ console.log('Stopping HLS stream');
26
+ await hmsActions.stopHLSStreaming();
27
+ ToastManager.addToast({ title: 'Stopping the stream' });
28
+ } catch (e) {
29
+ console.error('Error stopping stream', e);
30
+ ToastManager.addToast({ title: 'Error in stopping the stream', type: 'error' });
31
+ }
32
+ };
31
33
 
32
34
  const redirectToLeavePage = () => {
33
35
  if (showLeave) {
@@ -37,6 +39,7 @@ export const LeaveRoom = () => {
37
39
  navigate('/leave/' + params.roomId);
38
40
  }
39
41
  }
42
+ PictureInPicture.stop().catch(() => console.error('stopping pip'));
40
43
  ToastManager.clearAllToast();
41
44
  onLeave?.();
42
45
  };
@@ -46,147 +49,39 @@ export const LeaveRoom = () => {
46
49
  redirectToLeavePage();
47
50
  };
48
51
 
49
- const endRoom = () => {
50
- hmsActions.endRoom(lockRoom, 'End Room');
51
- redirectToLeavePage();
52
- };
52
+ // const endRoom = () => {
53
+ // hmsActions.endRoom(false, 'End Room');
54
+ // redirectToLeavePage();
55
+ // };
53
56
 
54
- const isStreamKit = isStreamingKit();
55
57
  if (!permissions || !isConnected) {
56
58
  return null;
57
59
  }
58
-
59
- return (
60
- <Fragment>
61
- {permissions.endRoom ? (
62
- <Flex>
63
- <LeaveIconButton
64
- variant="danger"
65
- key="LeaveRoom"
66
- data-testid="leave_room_btn"
67
- css={{ borderTopRightRadius: 0, borderBottomRightRadius: 0 }}
68
- onClick={leaveRoom}
69
- >
70
- <Tooltip title="Leave Room">
71
- {!isStreamKit ? (
72
- <Box>
73
- <HangUpIcon key="hangUp" />
74
- </Box>
75
- ) : (
76
- <Flex gap={2}>
77
- <Box css={{ '@md': { transform: 'rotate(180deg)' } }}>
78
- <ExitIcon key="hangUp" />
79
- </Box>
80
- <Text css={{ '@md': { display: 'none' }, color: 'inherit' }} variant="button">
81
- Leave Studio
82
- </Text>
83
- </Flex>
84
- )}
85
- </Tooltip>
86
- </LeaveIconButton>
87
- <Dropdown.Root open={open} onOpenChange={setOpen}>
88
- <Dropdown.Trigger
89
- asChild
90
- css={{
91
- '&[data-state="open"]': {
92
- bg: '$alert_error_dim',
93
- },
94
- }}
95
- >
96
- <MenuTriggerButton variant="danger" data-testid="leave_end_dropdown_trigger">
97
- <VerticalMenuIcon />
98
- </MenuTriggerButton>
99
- </Dropdown.Trigger>
100
- <Dropdown.Content css={{ p: 0 }} alignOffset={-50} sideOffset={10}>
101
- <Dropdown.Item
102
- css={{ w: '100%', bg: 'rgba(178, 71, 81, 0.1)' }}
103
- onClick={() => {
104
- setShowEndRoomModal(true);
105
- }}
106
- data-testid="end_room_btn"
107
- >
108
- <Flex gap={4}>
109
- <Box css={{ color: '$alert_error_default' }}>
110
- <AlertTriangleIcon />
111
- </Box>
112
- <Flex direction="column" align="start">
113
- <Text variant="lg" css={{ c: '$alert_error_default' }}>
114
- End Room for All
115
- </Text>
116
- <Text variant="sm" css={{ c: '$on_surface_medium', mt: '$2' }}>
117
- Warning: You can’t undo this action
118
- </Text>
119
- </Flex>
120
- </Flex>
121
- </Dropdown.Item>
122
- <Dropdown.Item css={{ bg: '$surface_default' }} onClick={leaveRoom} data-testid="just_leave_btn">
123
- <Flex gap={4}>
124
- <Box>
125
- <ExitIcon />
126
- </Box>
127
- <Flex direction="column" align="start">
128
- <Text variant="lg">Leave {isStreamKit ? 'Studio' : 'Room'}</Text>
129
- <Text variant="sm" css={{ c: '$on_surface_medium', mt: '$2' }}>
130
- You can always rejoin later
131
- </Text>
132
- </Flex>
133
- </Flex>
134
- </Dropdown.Item>
135
- </Dropdown.Content>
136
- </Dropdown.Root>
137
- </Flex>
138
- ) : (
139
- <LeaveIconButton onClick={leaveRoom} variant="danger" key="LeaveRoom" data-testid="leave_room_btn">
140
- <Tooltip title="Leave Room">
141
- <Box>
142
- {isStreamKit ? (
143
- <Box css={{ '@md': { transform: 'rotate(180deg)' } }}>
144
- <ExitIcon />
145
- </Box>
146
- ) : (
147
- <HangUpIcon key="hangUp" />
148
- )}
149
- </Box>
150
- </Tooltip>
151
- </LeaveIconButton>
152
- )}
153
-
154
- <Dialog.Root
155
- open={showEndRoomModal}
156
- onOpenChange={value => {
157
- if (!value) {
158
- setLockRoom(false);
159
- }
160
- setShowEndRoomModal(value);
161
- }}
162
- >
163
- <DialogContent title="End Room" Icon={HangUpIcon}>
164
- <DialogCheckbox id="lockRoom" title="Disable future joins" value={lockRoom} onChange={setLockRoom} />
165
- <DialogRow justify="end">
166
- <Button variant="danger" onClick={endRoom} data-testid="lock_end_room">
167
- End Room
168
- </Button>
169
- </DialogRow>
170
- </DialogContent>
171
- </Dialog.Root>
172
- </Fragment>
60
+ return isMobile ? (
61
+ <MwebLeaveRoom leaveIconButton={LeaveIconButton} leaveRoom={leaveRoom} stopStream={stopStream} />
62
+ ) : (
63
+ <DesktopLeaveRoom
64
+ leaveIconButton={LeaveIconButton}
65
+ menuTriggerButton={MenuTriggerButton}
66
+ leaveRoom={leaveRoom}
67
+ stopStream={stopStream}
68
+ />
173
69
  );
174
70
  };
175
71
 
176
72
  const LeaveIconButton = styled(IconButton, {
177
73
  color: '$on_primary_high',
178
74
  h: '$14',
179
- px: '$8',
75
+ px: '$4',
180
76
  r: '$1',
181
77
  bg: '$alert_error_default',
182
78
  '&:not([disabled]):hover': {
183
- bg: '$alert_error_default',
79
+ bg: '$alert_error_bright',
184
80
  },
185
81
  '&:not([disabled]):active': {
186
82
  bg: '$alert_error_default',
187
83
  },
188
84
  '@md': {
189
- px: '$4',
190
85
  mx: 0,
191
86
  },
192
87
  });
@@ -195,8 +90,5 @@ const MenuTriggerButton = styled(LeaveIconButton, {
195
90
  borderLeft: '1px solid $alert_error_dim',
196
91
  borderTopLeftRadius: 0,
197
92
  borderBottomLeftRadius: 0,
198
- px: '$3',
199
- '@md': {
200
- px: '$2',
201
- },
93
+ px: '$2',
202
94
  });
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { AlertTriangleIcon, CrossIcon } from '@100mslive/react-icons';
3
+ import { Button } from '../../Button';
4
+ import { Box, Flex } from '../../Layout';
5
+ import { Text } from '../../Text';
6
+
7
+ export const LeaveSessionContent = ({ setShowLeaveRoomAlert, leaveRoom, isModal = false }) => {
8
+ return (
9
+ <Box>
10
+ <Flex
11
+ css={{
12
+ color: '$alert_error_default',
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ }}
16
+ >
17
+ <AlertTriangleIcon style={{ marginRight: '0.5rem' }} />
18
+ <Text variant="lg" css={{ color: 'inherit', fontWeight: '$semiBold' }}>
19
+ Leave
20
+ </Text>
21
+ {isModal ? null : (
22
+ <Box css={{ color: '$on_surface_high', ml: 'auto' }} onClick={() => setShowLeaveRoomAlert(false)}>
23
+ <CrossIcon />
24
+ </Box>
25
+ )}
26
+ </Flex>
27
+ <Text variant="sm" css={{ color: '$on_surface_medium', mb: '$8', mt: '$4' }}>
28
+ Others will continue after you leave. You can join the session again.
29
+ </Text>
30
+ <Flex align="center" justify="between" css={{ w: '100%', gap: '$8' }}>
31
+ <Button
32
+ outlined
33
+ variant="standard"
34
+ css={{ w: '100%', '@md': { display: 'none' } }}
35
+ onClick={() => setShowLeaveRoomAlert(false)}
36
+ >
37
+ Cancel
38
+ </Button>
39
+ <Button variant="danger" css={{ w: '100%' }} onClick={leaveRoom} id="leaveRoom" data-testid="leave_room">
40
+ Leave Session
41
+ </Button>
42
+ </Flex>
43
+ </Box>
44
+ );
45
+ };
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import { Flex } from '../../../Layout';
3
+ import { Text } from '../../../Text';
4
+ import { styled } from '../../../Theme';
5
+
6
+ const ActionTileRoot = ({ active, disabled = false, children, onClick, ...props }) => (
7
+ <Flex
8
+ {...props}
9
+ css={{
10
+ flexDirection: 'column',
11
+ alignItems: 'center',
12
+ p: '$4 $2',
13
+ position: 'relative',
14
+ bg: active ? '$surface_bright' : '',
15
+ color: disabled ? '$on_surface_low' : '$on_surface_high',
16
+ gap: '$4',
17
+ r: '$1',
18
+ '&:hover': {
19
+ bg: '$surface_bright',
20
+ },
21
+ }}
22
+ onClick={() => {
23
+ if (!disabled) {
24
+ onClick();
25
+ }
26
+ }}
27
+ >
28
+ {children}
29
+ </Flex>
30
+ );
31
+
32
+ const ActionTileCount = styled(Text, {
33
+ position: 'absolute',
34
+ top: 0,
35
+ right: 0,
36
+ fontWeight: '$semiBold',
37
+ color: '$on_surface_high',
38
+ p: '$1 $2',
39
+ bg: '$surface_bright',
40
+ r: '$round',
41
+ fontSize: '$tiny !important',
42
+ });
43
+
44
+ const ActionTileTitle = styled(Text, {
45
+ fontWeight: '$semiBold',
46
+ color: 'inherit',
47
+ textAlign: 'center',
48
+ fontSize: '$xs !important',
49
+ });
50
+
51
+ export const ActionTile = {
52
+ Root: ActionTileRoot,
53
+ Title: ActionTileTitle,
54
+ Count: ActionTileCount,
55
+ };
@@ -0,0 +1,96 @@
1
+ import React from 'react';
2
+ import { ChevronLeftIcon, CrossIcon } from '@100mslive/react-icons';
3
+ import { Button } from '../../../Button';
4
+ import { Input } from '../../../Input';
5
+ import { Box, Flex } from '../../../Layout';
6
+ import { Text } from '../../../Text';
7
+
8
+ export const ChangeNameContent = ({
9
+ changeName,
10
+ setCurrentName,
11
+ currentName,
12
+ localPeerName,
13
+ isMobile,
14
+ onExit,
15
+ onBackClick,
16
+ }) => {
17
+ return (
18
+ <form
19
+ onSubmit={async e => {
20
+ e.preventDefault();
21
+ await changeName();
22
+ }}
23
+ >
24
+ <Text
25
+ variant={isMobile ? 'md' : 'lg'}
26
+ css={{
27
+ color: '$on_surface_high',
28
+ fontWeight: '$semiBold',
29
+ display: 'flex',
30
+ borderBottom: isMobile ? '1px solid $border_default' : '',
31
+ pb: '$6',
32
+ mb: '$8',
33
+ px: isMobile ? '$8' : '',
34
+ }}
35
+ >
36
+ {isMobile ? <ChevronLeftIcon onClick={onBackClick} style={{ marginRight: '0.5rem' }} /> : null}
37
+ Change Name
38
+ <Box css={{ color: 'inherit', ml: 'auto' }} onClick={onExit}>
39
+ <CrossIcon />
40
+ </Box>
41
+ </Text>
42
+ <Flex justify="center" align="center" css={{ my: '$8', w: '100%', px: isMobile ? '$8' : '' }}>
43
+ <Input
44
+ css={{ width: '100%', bg: '$surface_default' }}
45
+ value={currentName}
46
+ onChange={e => {
47
+ setCurrentName(e.target.value);
48
+ }}
49
+ autoComplete="name"
50
+ required
51
+ data-testid="change_name_field"
52
+ onKeyDown={async e => {
53
+ if (e.key === 'Enter' && currentName.trim().length > 0 && currentName !== localPeerName) {
54
+ e.preventDefault();
55
+ changeName();
56
+ }
57
+ }}
58
+ />
59
+ </Flex>
60
+
61
+ <Flex
62
+ justify="between"
63
+ align="center"
64
+ css={{
65
+ width: '100%',
66
+ gap: '$md',
67
+ mt: '$10',
68
+ px: isMobile ? '$4' : '',
69
+ }}
70
+ >
71
+ {isMobile ? null : (
72
+ <Button
73
+ variant="standard"
74
+ css={{ w: '100%' }}
75
+ outlined
76
+ type="submit"
77
+ disabled={!localPeerName}
78
+ onClick={onExit}
79
+ >
80
+ Cancel
81
+ </Button>
82
+ )}
83
+
84
+ <Button
85
+ variant="primary"
86
+ css={{ width: '100%' }}
87
+ type="submit"
88
+ disabled={!currentName.trim() || currentName.trim() === localPeerName}
89
+ data-testid="popup_change_btn"
90
+ >
91
+ Change
92
+ </Button>
93
+ </Flex>
94
+ </form>
95
+ );
96
+ };
@@ -1,14 +1,18 @@
1
1
  import React, { useState } from 'react';
2
+ import { useMedia } from 'react-use';
2
3
  import { selectLocalPeerName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
3
- import { Box, Button, Dialog, Flex, Input, Text } from '../../../';
4
+ import { config as cssConfig, Dialog } from '../../../';
5
+ import { Sheet } from '../../../Sheet';
4
6
  import { ToastManager } from '../Toast/ToastManager';
7
+ import { ChangeNameContent } from './ChangeNameContent';
5
8
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
6
9
 
7
- export const ChangeNameModal = ({ onOpenChange }) => {
10
+ export const ChangeNameModal = ({ onOpenChange, openParentSheet = null }) => {
8
11
  const [previewPreference, setPreviewPreference] = useUserPreferences(UserPreferencesKeys.PREVIEW);
9
12
  const hmsActions = useHMSActions();
10
13
  const localPeerName = useHMSStore(selectLocalPeerName);
11
14
  const [currentName, setCurrentName] = useState(localPeerName);
15
+ const isMobile = useMedia(cssConfig.media.md);
12
16
 
13
17
  const changeName = async () => {
14
18
  const name = currentName.trim();
@@ -29,62 +33,35 @@ export const ChangeNameModal = ({ onOpenChange }) => {
29
33
  }
30
34
  };
31
35
 
36
+ const props = {
37
+ changeName,
38
+ setCurrentName,
39
+ currentName,
40
+ localPeerName,
41
+ isMobile,
42
+ onExit: () => onOpenChange(false),
43
+ onBackClick: () => {
44
+ onOpenChange(false);
45
+ openParentSheet();
46
+ },
47
+ };
48
+
49
+ if (isMobile) {
50
+ return (
51
+ <Sheet.Root defaultOpen onOpenChange={onOpenChange}>
52
+ <Sheet.Content css={{ bg: '$surface_dim', py: '$8', px: 0 }}>
53
+ <ChangeNameContent {...props} />
54
+ </Sheet.Content>
55
+ </Sheet.Root>
56
+ );
57
+ }
58
+
32
59
  return (
33
60
  <Dialog.Root defaultOpen onOpenChange={onOpenChange}>
34
61
  <Dialog.Portal>
35
62
  <Dialog.Overlay />
36
- <Dialog.Content css={{ width: 'min(400px,80%)', p: '$10' }}>
37
- <Dialog.Title css={{ p: '0 $4' }}>
38
- <Text variant="h6"> Change Name</Text>
39
- </Dialog.Title>
40
- <form
41
- onSubmit={async e => {
42
- e.preventDefault();
43
- await changeName();
44
- }}
45
- >
46
- <Flex justify="center" align="center" css={{ my: '$8', w: '100%' }}>
47
- <Input
48
- css={{ width: '100%' }}
49
- value={currentName}
50
- onChange={e => {
51
- setCurrentName(e.target.value);
52
- }}
53
- autoComplete="name"
54
- required
55
- data-testid="change_name_field"
56
- />
57
- </Flex>
58
-
59
- <Flex
60
- justify="between"
61
- align="center"
62
- css={{
63
- width: '100%',
64
- gap: '$md',
65
- mt: '$10',
66
- }}
67
- >
68
- <Box css={{ w: '50%' }}>
69
- <Dialog.Close css={{ w: '100%' }}>
70
- <Button variant="standard" css={{ w: '100%' }} outlined type="submit" disabled={!localPeerName}>
71
- Cancel
72
- </Button>
73
- </Dialog.Close>
74
- </Box>
75
- <Box css={{ w: '50%' }}>
76
- <Button
77
- variant="primary"
78
- css={{ width: '100%' }}
79
- type="submit"
80
- disabled={!currentName.trim() || currentName.trim() === localPeerName}
81
- data-testid="popup_change_btn"
82
- >
83
- Change
84
- </Button>
85
- </Box>
86
- </Flex>
87
- </form>
63
+ <Dialog.Content css={{ bg: '$surface_dim', width: 'min(400px,80%)', p: '$10' }}>
64
+ <ChangeNameContent {...props} />
88
65
  </Dialog.Content>
89
66
  </Dialog.Portal>
90
67
  </Dialog.Root>
@@ -1,7 +1,6 @@
1
1
  import React, { useState } from 'react';
2
- import { ViewIcon } from '@100mslive/react-icons';
3
- import { Button, Dialog, Dropdown, Text } from '../../../';
4
- import { DialogContent, DialogInput, DialogRow } from '../../primitives/DialogContent';
2
+ import { LinkIcon } from '@100mslive/react-icons';
3
+ import { Button, Dialog, Dropdown, Flex, Input, Text } from '../../../';
5
4
  import { useSetAppDataByKey } from '../AppData/useUISettings';
6
5
  import { APP_DATA } from '../../common/constants';
7
6
 
@@ -17,7 +16,7 @@ export const EmbedUrl = ({ setShowOpenUrl }) => {
17
16
  }}
18
17
  data-testid="embed_url_btn"
19
18
  >
20
- <ViewIcon />
19
+ <LinkIcon />
21
20
  <Text variant="sm" css={{ ml: '$4' }}>
22
21
  Embed URL
23
22
  </Text>
@@ -29,78 +28,54 @@ export function EmbedUrlModal({ onOpenChange }) {
29
28
  const [embedConfig, setEmbedConfig] = useSetAppDataByKey(APP_DATA.embedConfig);
30
29
  const [url, setUrl] = useState(embedConfig?.url || '');
31
30
 
32
- const isAnythingEmbedded = !!embedConfig?.url;
33
- const isModifying = isAnythingEmbedded && url && url !== embedConfig.url;
34
-
35
31
  return (
36
32
  <Dialog.Root defaultOpen onOpenChange={onOpenChange}>
37
- <DialogContent title="Embed URL" Icon={ViewIcon}>
38
- <DialogInput title="URL" value={url} onChange={setUrl} placeholder="https://www.tldraw.com/" type="url" />
39
- <DialogRow>
40
- <Text>
41
- Embed a url and share with everyone in the room. Ensure that you're sharing the current tab when the prompt
42
- opens. Note that not all websites support being embedded.
33
+ <Dialog.Portal>
34
+ <Dialog.Overlay />
35
+ <Dialog.Content css={{ w: 'min(420px, 90%)', p: '$8', bg: '$surface_dim' }}>
36
+ <Dialog.Title
37
+ css={{
38
+ borderBottom: '1px solid $border_default',
39
+ color: '$on_surface_high',
40
+ display: 'flex',
41
+ alignItems: 'center',
42
+ }}
43
+ >
44
+ Embed URL
45
+ </Dialog.Title>
46
+ <Text variant="sm" css={{ color: '$on_surface_medium', mt: '$4', mb: '$8' }}>
47
+ Ensure that you're sharing the current tab when the prompt opens. Note that not all websites support being
48
+ embedded.
49
+ </Text>
50
+ <Text variant="sm" css={{ color: '$on_surface_high' }}>
51
+ URL
43
52
  </Text>
44
- </DialogRow>
45
- <DialogRow justify="end">
46
- {isAnythingEmbedded ? (
47
- <>
48
- <Button
49
- variant="primary"
50
- type="submit"
51
- disabled={!isModifying}
52
- onClick={() => {
53
- setEmbedConfig({ url, shareScreen: embedConfig.shareScreen });
54
- onOpenChange(false);
55
- }}
56
- data-testid="embed_url_btn"
57
- css={{ mr: '$4' }}
58
- >
59
- Update Embed
60
- </Button>
61
- <Button
62
- variant="danger"
63
- type="submit"
64
- onClick={() => {
65
- setEmbedConfig({ url: '' });
66
- onOpenChange(false);
67
- }}
68
- data-testid="embed_url_btn"
69
- >
70
- Stop Embed
71
- </Button>
72
- </>
73
- ) : (
74
- <>
75
- <Button
76
- variant="primary"
77
- type="submit"
78
- disabled={!url.trim()}
79
- onClick={() => {
80
- setEmbedConfig({ url });
81
- onOpenChange(false);
82
- }}
83
- data-testid="embed_url_btn"
84
- css={{ mr: '$4' }}
85
- >
86
- Just Embed
87
- </Button>
88
- <Button
89
- variant="primary"
90
- type="submit"
91
- disabled={!url.trim()}
92
- onClick={() => {
93
- setEmbedConfig({ url, shareScreen: true });
94
- onOpenChange(false);
95
- }}
96
- data-testid="embed_url_btn"
97
- >
98
- Embed and Share
99
- </Button>
100
- </>
101
- )}
102
- </DialogRow>
103
- </DialogContent>
53
+ <Input
54
+ css={{ w: '100%', mt: '$4' }}
55
+ placeholder="Enter your URL"
56
+ value={url}
57
+ onChange={e => setUrl(e.target.value)}
58
+ type="url"
59
+ />
60
+ <Flex justify="between" css={{ w: '100%', gap: '$8', mt: '$8' }}>
61
+ <Button outlined variant="standard" css={{ w: '100%' }} onClick={() => onOpenChange(false)}>
62
+ Cancel
63
+ </Button>
64
+ <Button
65
+ css={{ w: '100%' }}
66
+ type="submit"
67
+ disabled={!url.toString().trim()}
68
+ onClick={() => {
69
+ setEmbedConfig({ url, shareScreen: true });
70
+ onOpenChange(false);
71
+ }}
72
+ data-testid="embed_url_btn"
73
+ >
74
+ Embed and Share
75
+ </Button>
76
+ </Flex>
77
+ </Dialog.Content>
78
+ </Dialog.Portal>
104
79
  </Dialog.Root>
105
80
  );
106
81
  }