@100mslive/roomkit-react 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/{HLSView-662T7R7H.js → HLSView-EMUOLCTM.js} +128 -39
  2. package/dist/HLSView-EMUOLCTM.js.map +7 -0
  3. package/dist/Prebuilt/common/PeersSorter.d.ts +1 -0
  4. package/dist/Prebuilt/common/constants.d.ts +9 -5
  5. package/dist/Prebuilt/common/hooks.d.ts +1 -0
  6. package/dist/Prebuilt/components/Footer/ParticipantList.d.ts +17 -0
  7. package/dist/Prebuilt/components/Footer/RoleAccordion.d.ts +3 -2
  8. package/dist/Prebuilt/components/Footer/WhiteboardToggle.d.ts +2 -0
  9. package/dist/Prebuilt/components/HMSVideo/HLSCaptionSelector.d.ts +5 -0
  10. package/dist/Prebuilt/components/Notifications/HandRaisedNotifications.d.ts +1 -0
  11. package/dist/Prebuilt/components/Polls/Voting/Leaderboard.d.ts +4 -0
  12. package/dist/Prebuilt/components/Polls/Voting/LeaderboardEntry.d.ts +9 -0
  13. package/dist/Prebuilt/components/Polls/Voting/PeerParticipationSummary.d.ts +5 -0
  14. package/dist/Prebuilt/components/PreviousRoleInMetadata.d.ts +1 -0
  15. package/dist/Prebuilt/components/RemoveParticipant.d.ts +5 -0
  16. package/dist/Prebuilt/components/hooks/useCloseScreenshareWhiteboard.d.ts +4 -0
  17. package/dist/Prebuilt/layouts/WhiteboardView.d.ts +2 -0
  18. package/dist/{chunk-2B7YYNHQ.js → chunk-ZYR4B4KQ.js} +2240 -1767
  19. package/dist/chunk-ZYR4B4KQ.js.map +7 -0
  20. package/dist/index.cjs.js +2805 -2172
  21. package/dist/index.cjs.js.map +4 -4
  22. package/dist/index.js +1 -1
  23. package/dist/meta.cjs.json +739 -177
  24. package/dist/meta.esbuild.json +749 -186
  25. package/package.json +7 -7
  26. package/src/Prebuilt/AppStateContext.tsx +1 -1
  27. package/src/Prebuilt/common/PeersSorter.ts +24 -8
  28. package/src/Prebuilt/common/constants.ts +6 -6
  29. package/src/Prebuilt/common/hooks.ts +16 -0
  30. package/src/Prebuilt/common/utils.js +33 -0
  31. package/src/Prebuilt/components/AppData/AppData.tsx +1 -16
  32. package/src/Prebuilt/components/Chat/Chat.jsx +10 -34
  33. package/src/Prebuilt/components/Chat/ChatBody.jsx +107 -66
  34. package/src/Prebuilt/components/Chat/ChatFooter.tsx +21 -12
  35. package/src/Prebuilt/components/Chat/ChatSelector.tsx +25 -25
  36. package/src/Prebuilt/components/Chat/ChatSelectorContainer.tsx +15 -16
  37. package/src/Prebuilt/components/Chat/PinnedMessage.tsx +7 -2
  38. package/src/Prebuilt/components/ConferenceScreen.tsx +2 -0
  39. package/src/Prebuilt/components/Footer/ChatToggle.tsx +30 -7
  40. package/src/Prebuilt/components/Footer/Footer.tsx +2 -1
  41. package/src/Prebuilt/components/Footer/PaginatedParticipants.tsx +0 -1
  42. package/src/Prebuilt/components/Footer/{ParticipantList.jsx → ParticipantList.tsx} +169 -127
  43. package/src/Prebuilt/components/Footer/RoleAccordion.tsx +23 -13
  44. package/src/Prebuilt/components/Footer/WhiteboardToggle.tsx +34 -0
  45. package/src/Prebuilt/components/HMSVideo/HLSCaptionSelector.tsx +13 -0
  46. package/src/Prebuilt/components/HMSVideo/HMSVideo.jsx +34 -2
  47. package/src/Prebuilt/components/Notifications/HandRaisedNotifications.tsx +35 -0
  48. package/src/Prebuilt/components/Notifications/Notifications.tsx +47 -14
  49. package/src/Prebuilt/components/Notifications/PeerNotifications.tsx +7 -2
  50. package/src/Prebuilt/components/Polls/CreatePollQuiz/PollsQuizMenu.jsx +3 -9
  51. package/src/Prebuilt/components/Polls/CreateQuestions/CreateQuestions.jsx +21 -1
  52. package/src/Prebuilt/components/Polls/CreateQuestions/QuestionForm.jsx +34 -7
  53. package/src/Prebuilt/components/Polls/CreateQuestions/SavedQuestion.jsx +2 -2
  54. package/src/Prebuilt/components/Polls/Polls.tsx +3 -0
  55. package/src/Prebuilt/components/Polls/Voting/Leaderboard.tsx +115 -0
  56. package/src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx +63 -0
  57. package/src/Prebuilt/components/Polls/Voting/PeerParticipationSummary.tsx +38 -0
  58. package/src/Prebuilt/components/Polls/Voting/QuestionCard.jsx +33 -8
  59. package/src/Prebuilt/components/Polls/Voting/StandardVoting.jsx +7 -1
  60. package/src/Prebuilt/components/Polls/Voting/Voting.jsx +31 -13
  61. package/src/Prebuilt/components/Polls/common/MultipleChoiceOptions.jsx +33 -21
  62. package/src/Prebuilt/components/Polls/common/SingleChoiceOptions.jsx +47 -35
  63. package/src/Prebuilt/components/Polls/common/StatusIndicator.jsx +2 -22
  64. package/src/Prebuilt/components/Polls/common/VoteCount.jsx +1 -15
  65. package/src/Prebuilt/components/PreviousRoleInMetadata.tsx +21 -0
  66. package/src/Prebuilt/components/RemoveParticipant.tsx +35 -0
  67. package/src/Prebuilt/components/RoleChangeModal.jsx +1 -1
  68. package/src/Prebuilt/components/SidePaneTabs.tsx +0 -1
  69. package/src/Prebuilt/components/TileMenu/TileMenuContent.tsx +1 -1
  70. package/src/Prebuilt/components/Toast/ToastConfig.jsx +15 -3
  71. package/src/Prebuilt/components/VideoLayouts/EqualProminence.tsx +6 -5
  72. package/src/Prebuilt/components/VideoLayouts/GridLayout.tsx +27 -5
  73. package/src/Prebuilt/components/VideoLayouts/ScreenshareLayout.tsx +0 -1
  74. package/src/Prebuilt/components/hooks/useCloseScreenshareWhiteboard.tsx +24 -0
  75. package/src/Prebuilt/layouts/HLSView.jsx +51 -3
  76. package/src/Prebuilt/layouts/VideoStreamingSection.tsx +20 -3
  77. package/src/Prebuilt/layouts/WhiteboardView.tsx +66 -0
  78. package/dist/HLSView-662T7R7H.js.map +0 -7
  79. package/dist/chunk-2B7YYNHQ.js.map +0 -7
  80. package/src/Prebuilt/components/AppData/useAppLayout.js +0 -6
  81. package/src/Prebuilt/components/init/initUtils.js +0 -67
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.1.14",
13
+ "version": "0.1.16",
14
14
  "author": "100ms",
15
15
  "license": "MIT",
16
16
  "files": [
@@ -76,11 +76,11 @@
76
76
  "react": ">=17.0.2 <19.0.0"
77
77
  },
78
78
  "dependencies": {
79
- "@100mslive/hls-player": "0.1.23",
80
- "@100mslive/hms-virtual-background": "1.11.23",
81
- "@100mslive/react-icons": "0.8.23",
82
- "@100mslive/react-sdk": "0.8.23",
83
- "@100mslive/types-prebuilt": "0.12.4",
79
+ "@100mslive/hls-player": "0.1.25",
80
+ "@100mslive/hms-virtual-background": "1.11.25",
81
+ "@100mslive/react-icons": "0.8.25",
82
+ "@100mslive/react-sdk": "0.8.25",
83
+ "@100mslive/types-prebuilt": "0.12.5",
84
84
  "@emoji-mart/data": "^1.0.6",
85
85
  "@emoji-mart/react": "^1.0.1",
86
86
  "@radix-ui/react-accordion": "1.0.0",
@@ -115,5 +115,5 @@
115
115
  "uuid": "^8.3.2",
116
116
  "worker-timers": "^7.0.40"
117
117
  },
118
- "gitHead": "aed9a8922bbebf1015858ab5b4896acff5647c0a"
118
+ "gitHead": "096d50e1ffbeb9f2ec895b630952d2ad9694dfee"
119
119
  }
@@ -55,7 +55,7 @@ export const useAppStateManager = () => {
55
55
  setActiveState(PrebuiltStates.MEETING);
56
56
  } else if (
57
57
  prevRoomState &&
58
- [HMSRoomState.Reconnecting, HMSRoomState.Connected].includes(prevRoomState) &&
58
+ [HMSRoomState.Reconnecting, HMSRoomState.Connected, HMSRoomState.Connecting].includes(prevRoomState) &&
59
59
  [HMSRoomState.Disconnecting, HMSRoomState.Disconnected].includes(roomState)
60
60
  ) {
61
61
  const goTo = isPreviewScreenEnabled ? PrebuiltStates.PREVIEW : PrebuiltStates.MEETING;
@@ -17,6 +17,7 @@ class PeersSorter {
17
17
  }
18
18
 
19
19
  setPeersAndTilesPerPage = ({ peers, tilesPerPage }: { peers: HMSPeer[]; tilesPerPage: number }) => {
20
+ this.speaker = undefined;
20
21
  this.tilesPerPage = tilesPerPage;
21
22
  const peerIds = new Set(peers.map(peer => peer.id));
22
23
  // remove existing peers which are no longer provided
@@ -46,10 +47,13 @@ class PeersSorter {
46
47
  this.updateListeners();
47
48
  this.listeners.clear();
48
49
  this.storeUnsubscribe?.();
50
+ this.storeUnsubscribe = undefined;
51
+ this.speaker = undefined;
49
52
  };
50
53
 
51
54
  moveSpeakerToFront = (speaker?: HMSPeer) => {
52
55
  if (!speaker) {
56
+ this.maintainLruSize(this.tilesPerPage);
53
57
  this.updateListeners();
54
58
  return;
55
59
  }
@@ -59,19 +63,23 @@ class PeersSorter {
59
63
  }
60
64
  // delete to insert at beginning
61
65
  this.lruPeers.delete(speaker.id);
62
- const lruPeerArray = Array.from(this.lruPeers);
63
- while (lruPeerArray.length >= this.tilesPerPage && lruPeerArray.length) {
64
- lruPeerArray.pop();
65
- }
66
- this.lruPeers = new Set([speaker.id, ...lruPeerArray]);
66
+ // - 1 as we are going to insert the new speaker
67
+ this.maintainLruSize(this.tilesPerPage - 1);
68
+ this.lruPeers = new Set([speaker.id, ...this.lruPeers]);
67
69
  this.updateListeners();
68
70
  };
69
71
 
70
72
  onDominantSpeakerChange = (speaker: HMSPeer | null) => {
71
- if (speaker && speaker.id !== this?.speaker?.id) {
72
- this.speaker = speaker;
73
- this.moveSpeakerToFront(speaker);
73
+ // no speaker or is current speaker do nothing
74
+ if (!speaker || speaker.id === this.speaker?.id) {
75
+ return;
74
76
  }
77
+ // if the active speaker is not from the peers passed ignore
78
+ if (!this.peers.has(speaker.id)) {
79
+ return;
80
+ }
81
+ this.speaker = speaker;
82
+ this.moveSpeakerToFront(speaker);
75
83
  };
76
84
 
77
85
  updateListeners = () => {
@@ -89,6 +97,14 @@ class PeersSorter {
89
97
  });
90
98
  this.listeners.forEach(listener => listener?.(orderedPeers));
91
99
  };
100
+
101
+ private maintainLruSize = (size: number) => {
102
+ const lruPeerArray = Array.from(this.lruPeers);
103
+ while (lruPeerArray.length > size && lruPeerArray.length) {
104
+ lruPeerArray.pop();
105
+ }
106
+ this.lruPeers = new Set(lruPeerArray);
107
+ };
92
108
  }
93
109
 
94
110
  export default PeersSorter;
@@ -17,7 +17,7 @@ export const RTMP_RECORD_DEFAULT_RESOLUTION = {
17
17
  export const EMOJI_REACTION_TYPE = 'EMOJI_REACTION';
18
18
 
19
19
  export const CHAT_SELECTOR = {
20
- PEER_ID: 'peer_id',
20
+ PEER: 'peer',
21
21
  ROLE: 'role',
22
22
  EVERYONE: 'Everyone',
23
23
  };
@@ -33,7 +33,6 @@ export const APP_DATA = {
33
33
  waitingViewerRole: 'waitingViewerRole',
34
34
  subscribedNotifications: 'subscribedNotifications',
35
35
  logo: 'logo',
36
- appLayout: 'appLayout',
37
36
  hlsStarted: 'hlsStarted',
38
37
  rtmpStarted: 'rtmpStarted',
39
38
  recordingStarted: 'recordingStarted',
@@ -111,6 +110,7 @@ export enum SESSION_STORE_KEY {
111
110
  CHAT_PEER_BLACKLIST = 'chatPeerBlacklist',
112
111
  CHAT_MESSAGE_BLACKLIST = 'chatMessageBlacklist',
113
112
  CHAT_STATE = 'chatState',
113
+ SHARED_LEADERBOARDS = 'sharedLeaderboards',
114
114
  }
115
115
 
116
116
  export enum INTERACTION_TYPE {
@@ -121,15 +121,15 @@ export enum INTERACTION_TYPE {
121
121
  export enum QUESTION_TYPE_TITLE {
122
122
  'single-choice' = 'Single Choice',
123
123
  'multiple-choice' = 'Multiple Choice',
124
- // "short-answer": "Short Answer",
125
- // "long-answer": "Long Answer",
124
+ 'short-answer' = 'Short Answer',
125
+ 'long-answer' = 'Long Answer',
126
126
  }
127
127
 
128
128
  export enum QUESTION_TYPE {
129
129
  SINGLE_CHOICE = 'single-choice',
130
130
  MULTIPLE_CHOICE = 'multiple-choice',
131
- // SHORT_ANSWER: "short-answer",
132
- // LONG_ANSWER: "long-answer",
131
+ SHORT_ANSWER = 'short-answer',
132
+ LONG_ANSWER = 'long-answer',
133
133
  }
134
134
 
135
135
  export const ROLE_CHANGE_DECLINED = 'role_change_declined';
@@ -12,6 +12,7 @@ import {
12
12
  } from '@100mslive/react-sdk';
13
13
  import { useRoomLayout } from '../provider/roomLayoutProvider';
14
14
  import { useRoomLayoutConferencingScreen } from '../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
15
+ import { CHAT_SELECTOR } from './constants';
15
16
  /**
16
17
  * Hook to execute a callback when alone in room(after a certain 5d of time)
17
18
  * @param {number} thresholdMs The threshold(in ms) after which the callback is executed,
@@ -55,6 +56,21 @@ export const useFilteredRoles = () => {
55
56
  return elements?.chat?.roles_whitelist || [];
56
57
  };
57
58
 
59
+ export const useDefaultChatSelection = () => {
60
+ const { elements } = useRoomLayoutConferencingScreen();
61
+ const roles = useFilteredRoles();
62
+ // default is everyone for public chat
63
+ if (elements?.chat?.public_chat_enabled) {
64
+ return CHAT_SELECTOR.EVERYONE;
65
+ }
66
+ // sending first role as default
67
+ if (roles.length > 0) {
68
+ return roles[0];
69
+ }
70
+ // sending empty
71
+ return '';
72
+ };
73
+
58
74
  export const useShowStreamingUI = () => {
59
75
  const layout = useRoomLayout();
60
76
  const { join_form } = layout?.screens?.preview?.default?.elements || {};
@@ -137,3 +137,36 @@ export const calculateAvatarAndAttribBoxSize = (calculatedWidth, calculatedHeigh
137
137
  };
138
138
 
139
139
  export const isMobileUserAgent = /Mobi|Android|iPhone/i.test(navigator.userAgent);
140
+
141
+ export const getPeerResponses = (questions, peerid, userid) => {
142
+ return questions.map(question =>
143
+ question.responses?.filter(
144
+ response =>
145
+ ((response && response.peer?.peerid === peerid) || response.peer?.userid === userid) && !response.skipped,
146
+ ),
147
+ );
148
+ };
149
+
150
+ export const getPeerParticipationSummary = (poll, localPeerID, localCustomerUserID) => {
151
+ let correctResponses = 0;
152
+ let score = 0;
153
+ const questions = poll.questions || [];
154
+ const peerResponses = getPeerResponses(questions, localPeerID, localCustomerUserID);
155
+ let totalResponses = peerResponses.length || 0;
156
+
157
+ peerResponses.forEach(peerResponse => {
158
+ if (!peerResponse?.[0]) {
159
+ return;
160
+ }
161
+ const isCorrect = checkCorrectAnswer(
162
+ questions[peerResponse[0].questionIndex - 1].answer,
163
+ peerResponse[0],
164
+ questions[peerResponse[0].questionIndex - 1].type,
165
+ );
166
+ if (isCorrect) {
167
+ score += questions[peerResponse[0].questionIndex - 1]?.weight || 0;
168
+ correctResponses++;
169
+ }
170
+ });
171
+ return { totalResponses, correctResponses, score };
172
+ };
@@ -1,11 +1,8 @@
1
1
  import React, { useEffect } from 'react';
2
2
  import {
3
3
  HMSRoomState,
4
- selectAvailableRoleNames,
5
4
  selectFullAppData,
6
5
  selectHLSState,
7
- selectLocalPeerRoleName,
8
- selectRolesMap,
9
6
  selectRoomState,
10
7
  selectRTMPState,
11
8
  useHMSActions,
@@ -13,8 +10,6 @@ import {
13
10
  useRecordingStreaming,
14
11
  } from '@100mslive/react-sdk';
15
12
  //@ts-ignore
16
- import { normalizeAppPolicyConfig } from '../init/initUtils';
17
- //@ts-ignore
18
13
  import { UserPreferencesKeys, useUserPreferences } from '../hooks/useUserPreferences';
19
14
  // @ts-ignore
20
15
  import { useIsSidepaneTypeOpen, useSidepaneToggle } from './useSidepane';
@@ -49,7 +44,7 @@ const initialAppData = {
49
44
  [APP_DATA.chatOpen]: false,
50
45
  [APP_DATA.chatSelector]: {
51
46
  [CHAT_SELECTOR.ROLE]: '',
52
- [CHAT_SELECTOR.PEER_ID]: '',
47
+ [CHAT_SELECTOR.PEER]: {},
53
48
  },
54
49
  [APP_DATA.chatDraft]: '',
55
50
  [APP_DATA.sidePane]: '',
@@ -73,9 +68,6 @@ const initialAppData = {
73
68
  export const AppData = React.memo(() => {
74
69
  const hmsActions = useHMSActions();
75
70
  const [preferences = {}] = useUserPreferences(UserPreferencesKeys.UI_SETTINGS);
76
- const roleNames = useHMSStore(selectAvailableRoleNames);
77
- const rolesMap = useHMSStore(selectRolesMap);
78
- const localPeerRole = useHMSStore(selectLocalPeerRoleName);
79
71
  const appData = useHMSStore(selectFullAppData);
80
72
 
81
73
  useEffect(() => {
@@ -109,13 +101,6 @@ export const AppData = React.memo(() => {
109
101
  hmsActions.setAppData(APP_DATA.subscribedNotifications, preferences.subscribedNotifications, true);
110
102
  }, [preferences.subscribedNotifications, hmsActions]);
111
103
 
112
- useEffect(() => {
113
- if (localPeerRole) {
114
- const config = normalizeAppPolicyConfig(roleNames, rolesMap);
115
- hmsActions.setAppData(APP_DATA.appLayout, config[localPeerRole]);
116
- }
117
- }, [roleNames, rolesMap, localPeerRole, hmsActions]);
118
-
119
104
  return <ResetStreamingStart />;
120
105
  });
121
106
 
@@ -1,13 +1,7 @@
1
- import React, { useCallback, useEffect, useRef, useState } from 'react';
1
+ import React, { useCallback, useRef, useState } from 'react';
2
2
  import { useMedia } from 'react-use';
3
- import { selectLocalPeer, selectPeerByID, selectSessionStore } from '@100mslive/hms-video-store';
4
- import {
5
- HMSNotificationTypes,
6
- selectHMSMessagesCount,
7
- useHMSActions,
8
- useHMSNotifications,
9
- useHMSStore,
10
- } from '@100mslive/react-sdk';
3
+ import { selectLocalPeer, selectSessionStore, selectUnreadHMSMessagesCount } from '@100mslive/hms-video-store';
4
+ import { selectHMSMessagesCount, useHMSActions, useHMSStore } from '@100mslive/react-sdk';
11
5
  import { ChevronDownIcon } from '@100mslive/react-icons';
12
6
  import { Button } from '../../../Button';
13
7
  import { Flex } from '../../../Layout';
@@ -17,33 +11,18 @@ import { ChatFooter } from './ChatFooter';
17
11
  import { ChatBlocked, ChatPaused } from './ChatStates';
18
12
  import { PinnedMessage } from './PinnedMessage';
19
13
  import { useRoomLayoutConferencingScreen } from '../../provider/roomLayoutProvider/hooks/useRoomLayoutScreen';
20
- import { useSetSubscribedChatSelector } from '../AppData/useUISettings';
21
14
  import { useSetPinnedMessages } from '../hooks/useSetPinnedMessages';
22
- import { useUnreadCount } from './useUnreadCount';
23
- import { CHAT_SELECTOR, SESSION_STORE_KEY } from '../../common/constants';
15
+ import { SESSION_STORE_KEY } from '../../common/constants';
24
16
 
25
17
  export const Chat = () => {
26
18
  const { elements, screenType } = useRoomLayoutConferencingScreen();
27
- const notification = useHMSNotifications(HMSNotificationTypes.PEER_LEFT);
28
- const [selectedPeer, setPeerSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.PEER_ID);
29
- const [selectedRole, setRoleSelector] = useSetSubscribedChatSelector(CHAT_SELECTOR.ROLE);
30
19
  const localPeer = useHMSStore(selectLocalPeer);
31
20
  const [isSelectorOpen] = useState(false);
32
21
  const listRef = useRef(null);
33
22
  const hmsActions = useHMSActions();
34
23
  const { removePinnedMessage } = useSetPinnedMessages();
35
24
  const pinnedMessages = useHMSStore(selectSessionStore(SESSION_STORE_KEY.PINNED_MESSAGES)) || [];
36
- const isPeerPresent = !!useHMSStore(selectPeerByID(selectedPeer));
37
25
 
38
- useEffect(() => {
39
- if (notification && notification.data && selectedPeer === notification.data.id) {
40
- setPeerSelector('');
41
- setRoleSelector('');
42
- }
43
- if (selectedPeer && !isPeerPresent) {
44
- setPeerSelector('');
45
- }
46
- }, [notification, selectedPeer, setPeerSelector, setRoleSelector, isPeerPresent]);
47
26
  const blacklistedPeerIDs = useHMSStore(selectSessionStore(SESSION_STORE_KEY.CHAT_PEER_BLACKLIST)) || [];
48
27
  const blacklistedPeerIDSet = new Set(blacklistedPeerIDs);
49
28
  const isLocalPeerBlacklisted = blacklistedPeerIDSet.has(localPeer?.customerUserId);
@@ -97,17 +76,15 @@ export const Chat = () => {
97
76
 
98
77
  {isChatEnabled && !isLocalPeerBlacklisted ? (
99
78
  <ChatFooter onSend={() => scrollToBottom(1)} screenType={screenType}>
100
- {!isSelectorOpen && !isScrolledToBottom && (
101
- <NewMessageIndicator role={selectedRole} peerId={selectedPeer} scrollToBottom={scrollToBottom} />
102
- )}
79
+ {!isSelectorOpen && !isScrolledToBottom && <NewMessageIndicator scrollToBottom={scrollToBottom} />}
103
80
  </ChatFooter>
104
81
  ) : null}
105
82
  </Flex>
106
83
  );
107
84
  };
108
85
 
109
- const NewMessageIndicator = ({ role, peerId, scrollToBottom }) => {
110
- const unreadCount = useUnreadCount({ role, peerId });
86
+ const NewMessageIndicator = ({ scrollToBottom }) => {
87
+ const unreadCount = useHMSStore(selectUnreadHMSMessagesCount);
111
88
  if (!unreadCount) {
112
89
  return null;
113
90
  }
@@ -128,9 +105,8 @@ const NewMessageIndicator = ({ role, peerId, scrollToBottom }) => {
128
105
  }}
129
106
  icon
130
107
  css={{
131
- p: '$4',
132
- pl: '$8',
133
- pr: '$6',
108
+ p: '$3 $4',
109
+ pl: '$6',
134
110
  '& > svg': { ml: '$4' },
135
111
  borderRadius: '$round',
136
112
  position: 'relative',
@@ -141,7 +117,7 @@ const NewMessageIndicator = ({ role, peerId, scrollToBottom }) => {
141
117
  }}
142
118
  >
143
119
  New {unreadCount === 1 ? 'message' : 'messages'}
144
- <ChevronDownIcon />
120
+ <ChevronDownIcon height={16} width={16} />
145
121
  </Button>
146
122
  </Flex>
147
123
  );