@100mslive/roomkit-react 0.2.3 → 0.2.4-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/dist/{HLSView-2BP4GO3Q.js → HLSView-SPGUNWZM.js} +6 -6
  2. package/dist/HLSView-SPGUNWZM.js.map +7 -0
  3. package/dist/Prebuilt/common/constants.d.ts +1 -0
  4. package/dist/Prebuilt/components/Connection/TileConnection.d.ts +2 -3
  5. package/dist/Prebuilt/components/InsetTile.d.ts +3 -1
  6. package/dist/Prebuilt/components/LayoutModeSelector.d.ts +2 -0
  7. package/dist/Prebuilt/components/MoreSettings/ChangeNameContent.d.ts +10 -0
  8. package/dist/Prebuilt/components/MoreSettings/ChangeNameModal.d.ts +5 -0
  9. package/dist/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.d.ts +2 -0
  10. package/dist/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.d.ts +1 -2
  11. package/dist/Prebuilt/components/Polls/common/StatusIndicator.d.ts +4 -3
  12. package/dist/Prebuilt/components/Polls/common/constants.d.ts +5 -0
  13. package/dist/Prebuilt/components/ScreenshareDisplay.d.ts +2 -0
  14. package/dist/Prebuilt/components/ScreenshareTile.d.ts +7 -0
  15. package/dist/Prebuilt/components/SecondaryTiles.d.ts +1 -1
  16. package/dist/Prebuilt/components/Settings/LayoutSettings.d.ts +11 -0
  17. package/dist/Prebuilt/components/Settings/NotificationSettings.d.ts +2 -0
  18. package/dist/Prebuilt/components/Settings/SwitchWithLabel.d.ts +10 -0
  19. package/dist/Prebuilt/components/Settings/common.d.ts +878 -0
  20. package/dist/Prebuilt/components/TileMenu/TileMenu.d.ts +14 -0
  21. package/dist/Prebuilt/components/TileMenu/TileMenuContent.d.ts +7 -7
  22. package/dist/Prebuilt/components/VideoLayouts/ProminenceLayout.d.ts +4 -2
  23. package/dist/Prebuilt/components/VideoLayouts/interface.d.ts +1 -0
  24. package/dist/Prebuilt/components/VideoTile.d.ts +19 -0
  25. package/dist/Prebuilt/components/hooks/useDropdownList.d.ts +4 -0
  26. package/dist/{chunk-G25T3EBJ.js → chunk-FSSFZGW6.js} +1337 -1102
  27. package/dist/chunk-FSSFZGW6.js.map +7 -0
  28. package/dist/index.cjs.js +1835 -1580
  29. package/dist/index.cjs.js.map +4 -4
  30. package/dist/index.js +1 -1
  31. package/dist/meta.cjs.json +462 -297
  32. package/dist/meta.esbuild.json +474 -309
  33. package/package.json +6 -6
  34. package/src/Pagination/StyledPagination.tsx +1 -0
  35. package/src/Popover/index.tsx +8 -1
  36. package/src/Prebuilt/common/constants.ts +1 -0
  37. package/src/Prebuilt/components/AppData/AppData.tsx +2 -0
  38. package/src/Prebuilt/components/AppData/useUISettings.js +1 -1
  39. package/src/Prebuilt/components/Connection/ConnectionIndicator.tsx +1 -1
  40. package/src/Prebuilt/components/Connection/TileConnection.tsx +13 -6
  41. package/src/Prebuilt/components/Connection/connectionQualityUtils.js +1 -3
  42. package/src/Prebuilt/components/HlsStatsOverlay.jsx +2 -2
  43. package/src/Prebuilt/components/InsetTile.tsx +13 -6
  44. package/src/Prebuilt/components/LayoutModeSelector.tsx +106 -0
  45. package/src/Prebuilt/components/MoreSettings/{ChangeNameContent.jsx → ChangeNameContent.tsx} +10 -2
  46. package/src/Prebuilt/components/MoreSettings/{ChangeNameModal.jsx → ChangeNameModal.tsx} +14 -5
  47. package/src/Prebuilt/components/MoreSettings/SplitComponents/DesktopOptions.tsx +2 -2
  48. package/src/Prebuilt/components/MoreSettings/SplitComponents/MwebOptions.tsx +2 -2
  49. package/src/Prebuilt/components/Notifications/Notifications.tsx +0 -1
  50. package/src/Prebuilt/components/Playlist/VideoPlayer.jsx +1 -1
  51. package/src/Prebuilt/components/Polls/CreatePollQuiz/{PollsQuizMenu.jsx → PollsQuizMenu.tsx} +54 -26
  52. package/src/Prebuilt/components/Polls/CreateQuestions/CreateQuestions.jsx +21 -31
  53. package/src/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.tsx +3 -17
  54. package/src/Prebuilt/components/Polls/Voting/LeaderboardSummary.tsx +1 -1
  55. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +1 -10
  56. package/src/Prebuilt/components/Polls/Voting/Voting.tsx +1 -3
  57. package/src/Prebuilt/components/Polls/common/StatusIndicator.tsx +12 -3
  58. package/src/Prebuilt/components/Polls/common/constants.ts +5 -0
  59. package/src/Prebuilt/components/Preview/PreviewForm.tsx +2 -2
  60. package/src/Prebuilt/components/PreviousRoleInMetadata.tsx +1 -1
  61. package/src/Prebuilt/components/{ScreenshareTile.jsx → ScreenshareTile.tsx} +39 -6
  62. package/src/Prebuilt/components/SecondaryTiles.tsx +42 -4
  63. package/src/Prebuilt/components/Settings/DeviceSettings.jsx +1 -1
  64. package/src/Prebuilt/components/Settings/{LayoutSettings.jsx → LayoutSettings.tsx} +58 -14
  65. package/src/Prebuilt/components/Settings/{NotificationSettings.jsx → NotificationSettings.tsx} +14 -3
  66. package/src/Prebuilt/components/Settings/SettingsModal.jsx +32 -6
  67. package/src/Prebuilt/components/Settings/{SwitchWithLabel.jsx → SwitchWithLabel.tsx} +15 -1
  68. package/src/Prebuilt/components/Settings/common.ts +16 -0
  69. package/src/Prebuilt/components/TileMenu/{TileMenu.jsx → TileMenu.tsx} +12 -4
  70. package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +12 -10
  71. package/src/Prebuilt/components/VideoLayouts/ProminenceLayout.tsx +30 -15
  72. package/src/Prebuilt/components/VideoLayouts/RoleProminence.tsx +12 -2
  73. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +20 -5
  74. package/src/Prebuilt/components/VideoLayouts/interface.ts +1 -0
  75. package/src/Prebuilt/components/{VideoTile.jsx → VideoTile.tsx} +57 -44
  76. package/src/Prebuilt/components/VirtualBackground/VBPicker.tsx +2 -2
  77. package/src/Prebuilt/components/hooks/{useDropdownList.jsx → useDropdownList.ts} +2 -1
  78. package/src/Prebuilt/components/pdfAnnotator/shareScreenOptions.jsx +1 -1
  79. package/src/Prebuilt/layouts/HLSView.jsx +2 -2
  80. package/src/Prebuilt/layouts/SidePane.tsx +8 -4
  81. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +1 -1
  82. package/src/VideoTile/StyledVideoTile.tsx +4 -4
  83. package/dist/HLSView-2BP4GO3Q.js.map +0 -7
  84. package/dist/chunk-G25T3EBJ.js.map +0 -7
  85. package/src/Prebuilt/components/Settings/common.js +0 -41
  86. /package/src/Prebuilt/components/{ScreenshareDisplay.jsx → ScreenshareDisplay.tsx} +0 -0
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.2.3",
13
+ "version": "0.2.4-alpha.1",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "repository": {
@@ -82,10 +82,10 @@
82
82
  "react": ">=17.0.2 <19.0.0"
83
83
  },
84
84
  "dependencies": {
85
- "@100mslive/hls-player": "0.2.3",
86
- "@100mslive/hms-virtual-background": "1.12.3",
87
- "@100mslive/react-icons": "0.9.3",
88
- "@100mslive/react-sdk": "0.9.3",
85
+ "@100mslive/hls-player": "0.2.4-alpha.1",
86
+ "@100mslive/hms-virtual-background": "1.12.4-alpha.1",
87
+ "@100mslive/react-icons": "0.9.4-alpha.1",
88
+ "@100mslive/react-sdk": "0.9.4-alpha.1",
89
89
  "@100mslive/types-prebuilt": "0.12.6",
90
90
  "@emoji-mart/data": "^1.0.6",
91
91
  "@emoji-mart/react": "^1.0.1",
@@ -120,5 +120,5 @@
120
120
  "uuid": "^8.3.2",
121
121
  "worker-timers": "^7.0.40"
122
122
  },
123
- "gitHead": "83684d84e695eaf15f683f361848293c2df337a2"
123
+ "gitHead": "ae40b4fdc16f86138cb26086f63e4555cc439bba"
124
124
  }
@@ -14,6 +14,7 @@ const Root = styled('div', {
14
14
 
15
15
  const Chevron = styled('button', {
16
16
  color: '$on_surface_high',
17
+ border: 'none',
17
18
  '&:focus': {
18
19
  outline: 'none',
19
20
  },
@@ -15,7 +15,14 @@ const StyledArrow = styled(Arrow, {
15
15
  ...popoverAnimation,
16
16
  });
17
17
 
18
- const StyledTrigger = styled(Trigger, {});
18
+ const StyledTrigger = styled(Trigger, {
19
+ '&:hover': {
20
+ cursor: 'pointer',
21
+ },
22
+ '&:focus-visible': {
23
+ boxShadow: '0 0 0 3px $colors$primary_default',
24
+ },
25
+ });
19
26
 
20
27
  export const Popover = {
21
28
  Root,
@@ -52,6 +52,7 @@ export const UI_SETTINGS = {
52
52
  isAudioOnly: 'isAudioOnly',
53
53
  maxTileCount: 'maxTileCount',
54
54
  uiViewMode: 'uiViewMode',
55
+ layoutMode: 'layoutMode',
55
56
  showStatsOnTiles: 'showStatsOnTiles',
56
57
  enableAmbientMusic: 'enableAmbientMusic',
57
58
  mirrorLocalVideo: 'mirrorLocalVideo',
@@ -9,6 +9,7 @@ import {
9
9
  useHMSStore,
10
10
  useRecordingStreaming,
11
11
  } from '@100mslive/react-sdk';
12
+ import { LayoutMode } from '../Settings/LayoutSettings';
12
13
  //@ts-ignore
13
14
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
14
15
  // @ts-ignore
@@ -33,6 +34,7 @@ const initialAppData = {
33
34
  [UI_SETTINGS.enableAmbientMusic]: false,
34
35
  [UI_SETTINGS.uiViewMode]: UI_MODE_GRID,
35
36
  [UI_SETTINGS.mirrorLocalVideo]: true,
37
+ [UI_SETTINGS.layoutMode]: LayoutMode.GALLERY,
36
38
  },
37
39
  [APP_DATA.subscribedNotifications]: {
38
40
  PEER_JOINED: false,
@@ -165,7 +165,7 @@ const useSetAppData = ({ key1, key2 }) => {
165
165
 
166
166
  export const useShowPolls = () => {
167
167
  const permissions = useHMSStore(selectPermissions);
168
- const polls = useHMSStore(selectPolls)?.filter(poll => poll.state === 'started' || poll.state === 'stopped');
168
+ const polls = useHMSStore(selectPolls);
169
169
 
170
170
  const showPolls = useMemo(() => {
171
171
  return permissions?.pollWrite || (permissions?.pollRead && polls?.length > 0);
@@ -33,7 +33,7 @@ export const ConnectionIndicator = ({
33
33
  }) => {
34
34
  const downlinkQuality = useHMSStore(selectConnectionQualityByPeerID(peerId))?.downlinkQuality;
35
35
  const { theme } = useTheme();
36
- const defaultColor = theme.colors.surface_brighter;
36
+ const defaultColor = theme.colors.on_surface_low;
37
37
  if (downlinkQuality === -1 || downlinkQuality === undefined) {
38
38
  return null;
39
39
  }
@@ -1,28 +1,35 @@
1
1
  import React from 'react';
2
- import { PinIcon, SpotlightIcon } from '@100mslive/react-icons';
2
+ import { selectScreenShareByPeerID, selectSessionStore, useHMSStore } from '@100mslive/react-sdk';
3
+ import { PinIcon, ShareScreenIcon, SpotlightIcon } from '@100mslive/react-icons';
3
4
  import { Flex, styled, Text, textEllipsis } from '../../..';
4
5
  import { ConnectionIndicator } from './ConnectionIndicator';
6
+ import { SESSION_STORE_KEY } from '../../common/constants';
5
7
 
6
8
  const TileConnection = ({
7
9
  name,
8
10
  peerId,
9
11
  hideLabel,
10
12
  width,
11
- spotlighted,
12
13
  pinned,
13
14
  }: {
14
15
  name: string;
15
16
  peerId: string;
16
17
  hideLabel: boolean;
17
- width?: number;
18
- spotlighted?: boolean;
18
+ width?: string | number;
19
19
  pinned?: boolean;
20
20
  }) => {
21
+ const spotlighted = useHMSStore(selectSessionStore(SESSION_STORE_KEY.SPOTLIGHT)) === peerId;
22
+ const isPeerScreenSharing = !!useHMSStore(selectScreenShareByPeerID(peerId));
21
23
  return (
22
24
  <Wrapper>
23
25
  {!hideLabel ? (
24
26
  <>
25
27
  <Flex align="center">
28
+ {isPeerScreenSharing && (
29
+ <IconWrapper>
30
+ <ShareScreenIcon width="15" height="15" />
31
+ </IconWrapper>
32
+ )}
26
33
  {pinned && (
27
34
  <IconWrapper>
28
35
  <PinIcon width="15" height="15" />
@@ -37,7 +44,7 @@ const TileConnection = ({
37
44
  css={{
38
45
  c: '$on_surface_high',
39
46
  verticalAlign: 'baseline',
40
- ...(width ? textEllipsis(width - 60) : {}),
47
+ ...(width ? textEllipsis((width as number) - 60) : {}),
41
48
  }}
42
49
  variant="xs"
43
50
  >
@@ -51,7 +58,7 @@ const TileConnection = ({
51
58
  );
52
59
  };
53
60
 
54
- const IconWrapper = styled('div', { c: '$on_surface_high', ml: '$3', mt: '$1' });
61
+ const IconWrapper = styled('div', { c: '$on_surface_high', ml: '$3', mt: '$1', display: 'flex' });
55
62
 
56
63
  const Wrapper = styled('div', {
57
64
  display: 'flex',
@@ -30,10 +30,8 @@ export const getColor = (position, connectionScore, defaultColor, theme) => {
30
30
  }
31
31
  if (connectionScore >= 4) {
32
32
  return theme.colors.alert_success;
33
- } else if (connectionScore >= 3) {
34
- return theme.colors.alert_warning;
35
33
  } else if (connectionScore >= 1) {
36
- return theme.colors.alert_default;
34
+ return theme.colors.alert_warning;
37
35
  }
38
36
  return defaultColor;
39
37
  };
@@ -1,5 +1,5 @@
1
1
  import React, { memo } from 'react';
2
- import { CloseIcon } from '@100mslive/react-icons';
2
+ import { CrossIcon } from '@100mslive/react-icons';
3
3
  import { Flex } from '../../Layout';
4
4
  import { Text } from '../../Text';
5
5
  import IconButton from '../IconButton';
@@ -19,7 +19,7 @@ export function HlsStatsOverlay({ hlsStatsState, onClose }) {
19
19
  direction="column"
20
20
  >
21
21
  <IconButton css={{ position: 'absolute', top: '$2', right: '$2' }} onClick={onClose}>
22
- <CloseIcon />
22
+ <CrossIcon />
23
23
  </IconButton>
24
24
  <HlsStatsRow label="URL">
25
25
  <Flex align="center">
@@ -1,7 +1,13 @@
1
1
  import React, { useEffect, useRef } from 'react';
2
2
  import Draggable from 'react-draggable';
3
3
  import { useMedia } from 'react-use';
4
- import { selectIsAllowedToPublish, selectLocalPeer, selectVideoTrackByID, useHMSStore } from '@100mslive/react-sdk';
4
+ import {
5
+ selectIsAllowedToPublish,
6
+ selectLocalPeer,
7
+ selectPeerByID,
8
+ selectVideoTrackByID,
9
+ useHMSStore,
10
+ } from '@100mslive/react-sdk';
5
11
  import { ExpandIcon } from '@100mslive/react-icons';
6
12
  import { Box, Flex } from '../../Layout';
7
13
  import { Text } from '../../Text';
@@ -39,12 +45,13 @@ const insetMaxWidthPx = 240;
39
45
  const defaultMobileAspectRatio = 9 / 16;
40
46
  const desktopAspectRatio = 1 / defaultMobileAspectRatio;
41
47
 
42
- export const InsetTile = () => {
48
+ export const InsetTile = ({ peerId }: { peerId?: string }) => {
43
49
  const isMobile = useMedia(cssConfig.media.md);
44
50
  const isLandscape = useMedia(cssConfig.media.ls);
45
- const localPeer = useHMSStore(selectLocalPeer);
51
+ const selector = peerId ? selectPeerByID(peerId) : selectLocalPeer;
52
+ const peer = useHMSStore(selector);
46
53
  const [minimised, setMinimised] = useSetAppDataByKey(APP_DATA.minimiseInset);
47
- const videoTrack = useHMSStore(selectVideoTrackByID(localPeer?.videoTrack));
54
+ const videoTrack = useHMSStore(selectVideoTrackByID(peer?.videoTrack));
48
55
  const isAllowedToPublish = useHMSStore(selectIsAllowedToPublish);
49
56
  const videoTileProps = useVideoTileContext();
50
57
  let aspectRatio = isMobile ? defaultMobileAspectRatio : desktopAspectRatio;
@@ -108,8 +115,8 @@ export const InsetTile = () => {
108
115
  <MinimisedTile setMinimised={setMinimised} />
109
116
  ) : (
110
117
  <VideoTile
111
- peerId={localPeer?.id}
112
- trackid={localPeer?.videoTrack}
118
+ peerId={peer?.id}
119
+ trackId={peer?.videoTrack}
113
120
  rootCSS={{
114
121
  size: '100%',
115
122
  padding: 0,
@@ -0,0 +1,106 @@
1
+ import React, { useState } from 'react';
2
+ import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from '@100mslive/react-icons';
3
+ import { LayoutMode, LayoutModeIconMapping, LayoutModeKeys } from './Settings/LayoutSettings';
4
+ import { Flex } from '../../Layout';
5
+ import { Popover } from '../../Popover';
6
+ import { Text } from '../../Text';
7
+ // @ts-ignore: No implicit Any
8
+ import { useSetUiSettings } from '../components/AppData/useUISettings';
9
+ import { UI_SETTINGS } from '../common/constants';
10
+
11
+ export const LayoutModeSelector = () => {
12
+ const [open, setOpen] = useState(false);
13
+ const [layoutMode, setLayoutMode] = useSetUiSettings(UI_SETTINGS.layoutMode);
14
+
15
+ return (
16
+ <Popover.Root open={open} onOpenChange={setOpen}>
17
+ <Popover.Trigger asChild>
18
+ <Flex
19
+ align="center"
20
+ css={{
21
+ gap: '$4',
22
+ color: open ? '$on_surface_low' : '$on_surface_medium',
23
+ r: '$1',
24
+ p: '$2 $4',
25
+ height: '100%',
26
+ }}
27
+ >
28
+ <Flex
29
+ align="center"
30
+ justify="center"
31
+ css={{
32
+ color: 'inherit',
33
+ '& > svg': {
34
+ w: '$9',
35
+ h: '$9',
36
+ },
37
+ }}
38
+ >
39
+ {LayoutModeIconMapping[layoutMode as LayoutModeKeys]}
40
+ </Flex>
41
+ <Text variant="caption" css={{ color: 'inherit', lineHeight: '$sm' }}>
42
+ {layoutMode}
43
+ </Text>
44
+ {open ? <ChevronUpIcon width={16} height={16} /> : <ChevronDownIcon width={16} height={16} />}
45
+ </Flex>
46
+ </Popover.Trigger>
47
+ <Popover.Content
48
+ css={{
49
+ w: '10.75rem',
50
+ r: '$1',
51
+ py: '$4',
52
+ px: 0,
53
+ backgroundColor: '$surface_default',
54
+ overflowY: 'auto',
55
+ boxShadow: '0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23)',
56
+ fontFamily: '$sans',
57
+ color: '$on_surface_high',
58
+ }}
59
+ side="bottom"
60
+ sideOffset={8}
61
+ align="end"
62
+ >
63
+ {Object.keys(LayoutMode).map(key => {
64
+ const value = LayoutMode[key as LayoutModeKeys];
65
+ return (
66
+ <Flex
67
+ key={key}
68
+ onClick={() => setLayoutMode(value)}
69
+ align="center"
70
+ css={{
71
+ gap: '$4',
72
+ borderBottom: '1px solid $border_bright',
73
+ p: '$8',
74
+ '&:hover': {
75
+ cursor: 'pointer',
76
+ bg: '$surface_bright',
77
+ },
78
+ '&:focus-visible': {
79
+ bg: '$surface_bright',
80
+ },
81
+ }}
82
+ >
83
+ <Flex
84
+ align="center"
85
+ justify="center"
86
+ css={{
87
+ color: '$on_surface_medium',
88
+ '& > svg': {
89
+ w: '$9',
90
+ h: '$9',
91
+ },
92
+ }}
93
+ >
94
+ {LayoutModeIconMapping[value]}
95
+ </Flex>
96
+ <Text variant="caption" css={{ lineHeight: '$sm' }}>
97
+ {value}
98
+ </Text>
99
+ {value === layoutMode ? <CheckIcon width={20} height={20} style={{ marginLeft: 'auto' }} /> : null}
100
+ </Flex>
101
+ );
102
+ })}
103
+ </Popover.Content>
104
+ </Popover.Root>
105
+ );
106
+ };
@@ -13,6 +13,14 @@ export const ChangeNameContent = ({
13
13
  isMobile,
14
14
  onExit,
15
15
  onBackClick,
16
+ }: {
17
+ changeName: () => Promise<void>;
18
+ setCurrentName: (name: string) => void;
19
+ currentName?: string;
20
+ localPeerName?: string;
21
+ isMobile: boolean;
22
+ onExit: () => void;
23
+ onBackClick: () => void;
16
24
  }) => {
17
25
  return (
18
26
  <form
@@ -56,7 +64,7 @@ export const ChangeNameContent = ({
56
64
  required
57
65
  data-testid="change_name_field"
58
66
  onKeyDown={async e => {
59
- if (e.key === 'Enter' && currentName.trim().length > 0 && currentName !== localPeerName) {
67
+ if (e.key === 'Enter' && currentName && currentName.trim().length > 0 && currentName !== localPeerName) {
60
68
  e.preventDefault();
61
69
  if (isMobile) {
62
70
  return;
@@ -94,7 +102,7 @@ export const ChangeNameContent = ({
94
102
  variant="primary"
95
103
  css={{ width: '100%' }}
96
104
  type="submit"
97
- disabled={!currentName.trim() || currentName.trim() === localPeerName}
105
+ disabled={!currentName?.trim() || currentName?.trim() === localPeerName}
98
106
  data-testid="popup_change_btn"
99
107
  >
100
108
  Change
@@ -1,13 +1,22 @@
1
1
  import React, { useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
3
  import { selectLocalPeerName, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
4
- import { config as cssConfig, Dialog } from '../../../';
4
+ import { config as cssConfig, Dialog } from '../../..';
5
5
  import { Sheet } from '../../../Sheet';
6
+ // @ts-ignore: No implicit Any
6
7
  import { ToastManager } from '../Toast/ToastManager';
8
+ // @ts-ignore: No implicit Any
7
9
  import { ChangeNameContent } from './ChangeNameContent';
10
+ // @ts-ignore: No implicit Any
8
11
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
9
12
 
10
- export const ChangeNameModal = ({ onOpenChange, openParentSheet = null }) => {
13
+ export const ChangeNameModal = ({
14
+ onOpenChange,
15
+ openParentSheet = undefined,
16
+ }: {
17
+ onOpenChange: (value: boolean) => void;
18
+ openParentSheet?: () => void;
19
+ }) => {
11
20
  const [previewPreference, setPreviewPreference] = useUserPreferences(UserPreferencesKeys.PREVIEW);
12
21
  const hmsActions = useHMSActions();
13
22
  const localPeerName = useHMSStore(selectLocalPeerName);
@@ -15,7 +24,7 @@ export const ChangeNameModal = ({ onOpenChange, openParentSheet = null }) => {
15
24
  const isMobile = useMedia(cssConfig.media.md);
16
25
 
17
26
  const changeName = async () => {
18
- const name = currentName.trim();
27
+ const name = currentName?.trim() || '';
19
28
  if (!name || name === localPeerName) {
20
29
  return;
21
30
  }
@@ -27,7 +36,7 @@ export const ChangeNameModal = ({ onOpenChange, openParentSheet = null }) => {
27
36
  });
28
37
  } catch (error) {
29
38
  console.error('failed to update name', error);
30
- ToastManager.addToast({ title: error.message });
39
+ ToastManager.addToast({ title: (error as Error).message });
31
40
  } finally {
32
41
  onOpenChange(false);
33
42
  }
@@ -42,7 +51,7 @@ export const ChangeNameModal = ({ onOpenChange, openParentSheet = null }) => {
42
51
  onExit: () => onOpenChange(false),
43
52
  onBackClick: () => {
44
53
  onOpenChange(false);
45
- openParentSheet();
54
+ openParentSheet?.();
46
55
  },
47
56
  };
48
57
 
@@ -6,7 +6,7 @@ import {
6
6
  HLSLiveStreamingScreen_Elements,
7
7
  } from '@100mslive/types-prebuilt';
8
8
  import { selectAppData, selectLocalPeerID, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
9
- import { BrbIcon, CheckIcon, DragHandleIcon, InfoIcon, PipIcon, SettingsIcon } from '@100mslive/react-icons';
9
+ import { BrbIcon, CheckIcon, HamburgerMenuIcon, InfoIcon, PipIcon, SettingsIcon } from '@100mslive/react-icons';
10
10
  import { Checkbox, Dropdown, Flex, Text, Tooltip } from '../../../..';
11
11
  // @ts-ignore: No implicit any
12
12
  import IconButton from '../../../IconButton';
@@ -88,7 +88,7 @@ export const DesktopOptions = ({
88
88
  <Tooltip title="More options">
89
89
  <Dropdown.Trigger asChild data-testid="more_settings_btn">
90
90
  <IconButton>
91
- <DragHandleIcon />
91
+ <HamburgerMenuIcon />
92
92
  </IconButton>
93
93
  </Dropdown.Trigger>
94
94
  </Tooltip>
@@ -13,8 +13,8 @@ import {
13
13
  import {
14
14
  BrbIcon,
15
15
  CrossIcon,
16
- DragHandleIcon,
17
16
  EmojiIcon,
17
+ HamburgerMenuIcon,
18
18
  HandIcon,
19
19
  HandRaiseSlashedIcon,
20
20
  PeopleIcon,
@@ -119,7 +119,7 @@ export const MwebOptions = ({
119
119
  <Tooltip title="More options">
120
120
  <Sheet.Trigger asChild data-testid="more_settings_btn">
121
121
  <IconButton>
122
- <DragHandleIcon />
122
+ <HamburgerMenuIcon />
123
123
  </IconButton>
124
124
  </Sheet.Trigger>
125
125
  </Tooltip>
@@ -36,7 +36,6 @@ import { usePollViewToggle } from '../AppData/useSidepane';
36
36
  import { useIsNotificationDisabled, useSubscribedNotifications } from '../AppData/useUISettings';
37
37
  // @ts-ignore: No implicit Any
38
38
  import { getMetadata } from '../../common/utils';
39
- // @ts-ignore: No implicit Any
40
39
  import { ROLE_CHANGE_DECLINED } from '../../common/constants';
41
40
 
42
41
  const pollToastKey: Record<string, string> = {};
@@ -78,7 +78,7 @@ export const VideoPlayer = React.memo(({ peerId }) => {
78
78
  <VideoPlaylistControls>
79
79
  {screenfull.enabled && (
80
80
  <IconButton
81
- onClick={() => toggle()}
81
+ onClick={toggle}
82
82
  css={{
83
83
  color: '$on_primary_high',
84
84
  height: 'max-content',
@@ -1,17 +1,21 @@
1
- // @ts-check
2
1
  import React, { useEffect, useMemo, useRef, useState } from 'react';
3
2
  import {
3
+ HMSPoll,
4
+ HMSPollState,
4
5
  selectLocalPeerRoleName,
5
6
  selectPermissions,
6
- selectPolls,
7
7
  useHMSActions,
8
8
  useHMSStore,
9
9
  } from '@100mslive/react-sdk';
10
10
  import { QuestionIcon, StatsIcon } from '@100mslive/react-icons';
11
- import { Button, Flex, Input, Switch, Text } from '../../../../';
11
+ import { Button, Flex, Input, Switch, Text } from '../../../..';
12
+ // @ts-ignore
12
13
  import { Container, ContentHeader, ErrorText } from '../../Streaming/Common';
14
+ // @ts-ignore
13
15
  import { usePollViewToggle } from '../../AppData/useSidepane';
16
+ // @ts-ignore
14
17
  import { usePollViewState } from '../../AppData/useUISettings';
18
+ // @ts-ignore
15
19
  import { isValidTextInput } from '../../../common/utils';
16
20
  import { StatusIndicator } from '../common/StatusIndicator';
17
21
  import { INTERACTION_TYPE, POLL_STATE, POLL_VIEWS } from '../../../common/constants';
@@ -31,7 +35,17 @@ export const PollsQuizMenu = () => {
31
35
  );
32
36
  };
33
37
 
34
- function InteractionSelectionCard({ title, icon, active, onClick }) {
38
+ function InteractionSelectionCard({
39
+ title,
40
+ icon,
41
+ active,
42
+ onClick,
43
+ }: {
44
+ title: string;
45
+ icon: React.JSX.Element;
46
+ active: boolean;
47
+ onClick: () => void;
48
+ }) {
35
49
  const activeBorderStyle = active ? '$space$px solid $primary_default' : '$space$px solid $border_bright';
36
50
  return (
37
51
  <Flex
@@ -73,7 +87,7 @@ const AddMenu = () => {
73
87
  const { setPollState } = usePollViewState();
74
88
  const [interactionType, setInteractionType] = useState(INTERACTION_TYPE.POLL);
75
89
 
76
- const inputRef = useRef(null);
90
+ const inputRef = useRef<HTMLInputElement>(null);
77
91
 
78
92
  useEffect(() => {
79
93
  if (inputRef.current) {
@@ -81,7 +95,7 @@ const AddMenu = () => {
81
95
  }
82
96
  }, [interactionType]);
83
97
 
84
- const handleCreate = id => {
98
+ const handleCreate = (id: string) => {
85
99
  setPollState({
86
100
  [POLL_STATE.pollInView]: id,
87
101
  [POLL_STATE.view]: POLL_VIEWS.CREATE_QUESTIONS,
@@ -99,8 +113,6 @@ const AddMenu = () => {
99
113
  return false;
100
114
  }
101
115
  }, [title]);
102
- // const [timer, setTimer] = useState(10);
103
- // const [showTimerDropDown, setShowTimerDropDown] = useState(false);
104
116
 
105
117
  return (
106
118
  <>
@@ -165,8 +177,8 @@ const AddMenu = () => {
165
177
  title,
166
178
  anonymous: false,
167
179
  rolesThatCanViewResponses: hideVoteCount && localPeerRoleName ? [localPeerRoleName] : undefined,
180
+ // @ts-ignore
168
181
  type: interactionType.toLowerCase(),
169
- // duration: showTimerDropDown ? timer : undefined,
170
182
  })
171
183
  .then(() => handleCreate(id))
172
184
  .catch(err => setError(err.message));
@@ -181,11 +193,26 @@ const AddMenu = () => {
181
193
  };
182
194
 
183
195
  const PrevMenu = () => {
184
- // filter polls that have been started or stopped sorted by when they were created and their live state
185
- const polls = useHMSStore(selectPolls)
186
- ?.filter(poll => poll.state === 'started' || poll.state === 'stopped')
187
- .sort((a, b) => (b.createdAt?.getTime() || 0) - (a.createdAt?.getTime() || 0))
188
- .sort((a, b) => (b.state === 'started' ? 1 : 0) - (a.state === 'started' ? 1 : 0));
196
+ const hmsActions = useHMSActions();
197
+ const [polls, setPolls] = useState<HMSPoll[]>([]);
198
+
199
+ useEffect(() => {
200
+ const listPolls = async () => {
201
+ const polls = await hmsActions.interactivityCenter.getPolls();
202
+ const sortedPolls = await polls
203
+ ?.sort((a, b) => (b.createdAt?.getTime() || 0) - (a.createdAt?.getTime() || 0))
204
+ ?.sort((a, b) => (b.state === 'started' ? 1 : 0) - (a.state === 'started' ? 1 : 0));
205
+ return sortedPolls;
206
+ };
207
+
208
+ const updatePolls = async () => {
209
+ const sortedPolls = await listPolls();
210
+ setPolls(sortedPolls);
211
+ };
212
+
213
+ updatePolls();
214
+ }, [hmsActions.interactivityCenter]);
215
+
189
216
  return polls?.length ? (
190
217
  <Flex
191
218
  css={{
@@ -199,8 +226,8 @@ const PrevMenu = () => {
199
226
  Previous Polls and Quizzes
200
227
  </Text>
201
228
  <Flex direction="column" css={{ gap: '$10', mt: '$8' }}>
202
- {polls.map(poll => (
203
- <InteractionCard key={poll.id} id={poll.id} title={poll.title} isLive={poll.state === 'started'} />
229
+ {polls?.map(poll => (
230
+ <InteractionCard key={poll.id} id={poll.id} title={poll.title} status={poll.state} />
204
231
  ))}
205
232
  </Flex>
206
233
  </Flex>
@@ -208,26 +235,27 @@ const PrevMenu = () => {
208
235
  ) : null;
209
236
  };
210
237
 
211
- const InteractionCard = ({ id, title, isLive }) => {
238
+ const InteractionCard = ({ id, title, status }: { id: string; title: string; status?: HMSPollState }) => {
212
239
  const { setPollState } = usePollViewState();
213
240
 
214
- const goToVote = id => {
215
- setPollState({
216
- [POLL_STATE.pollInView]: id,
217
- [POLL_STATE.view]: POLL_VIEWS.VOTE,
218
- });
219
- };
220
-
221
241
  return (
222
242
  <Flex direction="column" css={{ backgroundColor: '$surface_bright', borderRadius: '$1', p: '$8' }}>
223
243
  <Flex css={{ w: '100%', justifyContent: 'space-between', mb: '$sm' }}>
224
244
  <Text variant="sub1" css={{ c: '$on_surface_high', fontWeight: '$semiBold' }}>
225
245
  {title}
226
246
  </Text>
227
- <StatusIndicator isLive={isLive} />
247
+ <StatusIndicator status={status} />
228
248
  </Flex>
229
249
  <Flex css={{ w: '100%', gap: '$4' }} justify="end">
230
- <Button variant="primary" onClick={() => goToVote(id)}>
250
+ <Button
251
+ variant="primary"
252
+ onClick={() =>
253
+ setPollState({
254
+ [POLL_STATE.pollInView]: id,
255
+ [POLL_STATE.view]: status === 'created' ? POLL_VIEWS.CREATE_QUESTIONS : POLL_VIEWS.VOTE,
256
+ })
257
+ }
258
+ >
231
259
  View
232
260
  </Button>
233
261
  </Flex>