@100mslive/roomkit-react 0.2.2-alpha.3 → 0.2.2-alpha.5

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.js CHANGED
@@ -62,7 +62,7 @@ import {
62
62
  theme,
63
63
  useBorderAudioLevel,
64
64
  useTheme
65
- } from "./chunk-O7BEFUE4.js";
65
+ } from "./chunk-YOFFMNAR.js";
66
66
  export {
67
67
  Accordion,
68
68
  AudioLevel,
@@ -4478,7 +4478,7 @@
4478
4478
  "format": "cjs"
4479
4479
  },
4480
4480
  "../hms-video-store/dist/index.js": {
4481
- "bytes": 320733,
4481
+ "bytes": 320789,
4482
4482
  "imports": [
4483
4483
  {
4484
4484
  "path": "../../node_modules/reselect/es/index.js",
@@ -6696,8 +6696,19 @@
6696
6696
  ],
6697
6697
  "format": "esm"
6698
6698
  },
6699
+ "src/Prebuilt/components/Polls/common/utils.ts": {
6700
+ "bytes": 482,
6701
+ "imports": [
6702
+ {
6703
+ "path": "<define:process.env>",
6704
+ "kind": "import-statement",
6705
+ "external": true
6706
+ }
6707
+ ],
6708
+ "format": "esm"
6709
+ },
6699
6710
  "src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx": {
6700
- "bytes": 2113,
6711
+ "bytes": 2162,
6701
6712
  "imports": [
6702
6713
  {
6703
6714
  "path": "react",
@@ -6719,6 +6730,11 @@
6719
6730
  "kind": "import-statement",
6720
6731
  "original": "../../../../Text"
6721
6732
  },
6733
+ {
6734
+ "path": "src/Prebuilt/components/Polls/common/utils.ts",
6735
+ "kind": "import-statement",
6736
+ "original": "../common/utils"
6737
+ },
6722
6738
  {
6723
6739
  "path": "<define:process.env>",
6724
6740
  "kind": "import-statement",
@@ -6780,7 +6796,7 @@
6780
6796
  "format": "esm"
6781
6797
  },
6782
6798
  "src/Prebuilt/components/Polls/Voting/PeerParticipationSummary.tsx": {
6783
- "bytes": 2297,
6799
+ "bytes": 2279,
6784
6800
  "imports": [
6785
6801
  {
6786
6802
  "path": "react",
@@ -6812,6 +6828,11 @@
6812
6828
  "kind": "import-statement",
6813
6829
  "original": "./useQuizSummary"
6814
6830
  },
6831
+ {
6832
+ "path": "src/Prebuilt/components/Polls/common/utils.ts",
6833
+ "kind": "import-statement",
6834
+ "original": "../common/utils"
6835
+ },
6815
6836
  {
6816
6837
  "path": "<define:process.env>",
6817
6838
  "kind": "import-statement",
@@ -6897,7 +6918,7 @@
6897
6918
  "format": "esm"
6898
6919
  },
6899
6920
  "src/Prebuilt/components/Polls/Voting/QuestionCard.jsx": {
6900
- "bytes": 7009,
6921
+ "bytes": 7080,
6901
6922
  "imports": [
6902
6923
  {
6903
6924
  "path": "react",
@@ -12572,7 +12593,7 @@
12572
12593
  "imports": [],
12573
12594
  "exports": [],
12574
12595
  "inputs": {},
12575
- "bytes": 3068442
12596
+ "bytes": 3069617
12576
12597
  },
12577
12598
  "dist/index.cjs.js": {
12578
12599
  "imports": [
@@ -15246,7 +15267,7 @@
15246
15267
  "entryPoint": "src/index.ts",
15247
15268
  "inputs": {
15248
15269
  "<define:process.env>": {
15249
- "bytesInOutput": 17184
15270
+ "bytesInOutput": 17187
15250
15271
  },
15251
15272
  "src/Theme/base.config.ts": {
15252
15273
  "bytesInOutput": 6104
@@ -15863,8 +15884,11 @@
15863
15884
  "src/Prebuilt/components/Polls/CreateQuestions/CreateQuestions.jsx": {
15864
15885
  "bytesInOutput": 5588
15865
15886
  },
15887
+ "src/Prebuilt/components/Polls/common/utils.ts": {
15888
+ "bytesInOutput": 664
15889
+ },
15866
15890
  "src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx": {
15867
- "bytesInOutput": 2704
15891
+ "bytesInOutput": 2717
15868
15892
  },
15869
15893
  "src/Prebuilt/components/Polls/Voting/StatisticBox.tsx": {
15870
15894
  "bytesInOutput": 978
@@ -15873,13 +15897,13 @@
15873
15897
  "bytesInOutput": 2203
15874
15898
  },
15875
15899
  "src/Prebuilt/components/Polls/Voting/PeerParticipationSummary.tsx": {
15876
- "bytesInOutput": 2928
15900
+ "bytesInOutput": 2877
15877
15901
  },
15878
15902
  "src/Prebuilt/components/Polls/Voting/LeaderboardSummary.tsx": {
15879
15903
  "bytesInOutput": 5052
15880
15904
  },
15881
15905
  "src/Prebuilt/components/Polls/Voting/QuestionCard.jsx": {
15882
- "bytesInOutput": 8545
15906
+ "bytesInOutput": 8770
15883
15907
  },
15884
15908
  "src/Prebuilt/components/Polls/Voting/StandardVoting.tsx": {
15885
15909
  "bytesInOutput": 1658
@@ -16242,7 +16266,7 @@
16242
16266
  "bytesInOutput": 2980
16243
16267
  }
16244
16268
  },
16245
- "bytes": 1439261
16269
+ "bytes": 1440165
16246
16270
  }
16247
16271
  }
16248
16272
  }
@@ -4478,7 +4478,7 @@
4478
4478
  "format": "cjs"
4479
4479
  },
4480
4480
  "../hms-video-store/dist/index.js": {
4481
- "bytes": 320733,
4481
+ "bytes": 320789,
4482
4482
  "imports": [
4483
4483
  {
4484
4484
  "path": "../../node_modules/reselect/es/index.js",
@@ -6696,8 +6696,19 @@
6696
6696
  ],
6697
6697
  "format": "esm"
6698
6698
  },
6699
+ "src/Prebuilt/components/Polls/common/utils.ts": {
6700
+ "bytes": 482,
6701
+ "imports": [
6702
+ {
6703
+ "path": "<define:process.env>",
6704
+ "kind": "import-statement",
6705
+ "external": true
6706
+ }
6707
+ ],
6708
+ "format": "esm"
6709
+ },
6699
6710
  "src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx": {
6700
- "bytes": 2113,
6711
+ "bytes": 2162,
6701
6712
  "imports": [
6702
6713
  {
6703
6714
  "path": "react",
@@ -6719,6 +6730,11 @@
6719
6730
  "kind": "import-statement",
6720
6731
  "original": "../../../../Text"
6721
6732
  },
6733
+ {
6734
+ "path": "src/Prebuilt/components/Polls/common/utils.ts",
6735
+ "kind": "import-statement",
6736
+ "original": "../common/utils"
6737
+ },
6722
6738
  {
6723
6739
  "path": "<define:process.env>",
6724
6740
  "kind": "import-statement",
@@ -6780,7 +6796,7 @@
6780
6796
  "format": "esm"
6781
6797
  },
6782
6798
  "src/Prebuilt/components/Polls/Voting/PeerParticipationSummary.tsx": {
6783
- "bytes": 2297,
6799
+ "bytes": 2279,
6784
6800
  "imports": [
6785
6801
  {
6786
6802
  "path": "react",
@@ -6812,6 +6828,11 @@
6812
6828
  "kind": "import-statement",
6813
6829
  "original": "./useQuizSummary"
6814
6830
  },
6831
+ {
6832
+ "path": "src/Prebuilt/components/Polls/common/utils.ts",
6833
+ "kind": "import-statement",
6834
+ "original": "../common/utils"
6835
+ },
6815
6836
  {
6816
6837
  "path": "<define:process.env>",
6817
6838
  "kind": "import-statement",
@@ -6897,7 +6918,7 @@
6897
6918
  "format": "esm"
6898
6919
  },
6899
6920
  "src/Prebuilt/components/Polls/Voting/QuestionCard.jsx": {
6900
- "bytes": 7009,
6921
+ "bytes": 7080,
6901
6922
  "imports": [
6902
6923
  {
6903
6924
  "path": "react",
@@ -12577,7 +12598,7 @@
12577
12598
  "dist/index.js": {
12578
12599
  "imports": [
12579
12600
  {
12580
- "path": "dist/chunk-O7BEFUE4.js",
12601
+ "path": "dist/chunk-YOFFMNAR.js",
12581
12602
  "kind": "import-statement"
12582
12603
  }
12583
12604
  ],
@@ -12650,16 +12671,16 @@
12650
12671
  "inputs": {},
12651
12672
  "bytes": 1822
12652
12673
  },
12653
- "dist/HLSView-ZG7ZVFEM.js.map": {
12674
+ "dist/HLSView-HMMJY2KC.js.map": {
12654
12675
  "imports": [],
12655
12676
  "exports": [],
12656
12677
  "inputs": {},
12657
12678
  "bytes": 58852
12658
12679
  },
12659
- "dist/HLSView-ZG7ZVFEM.js": {
12680
+ "dist/HLSView-HMMJY2KC.js": {
12660
12681
  "imports": [
12661
12682
  {
12662
- "path": "dist/chunk-O7BEFUE4.js",
12683
+ "path": "dist/chunk-YOFFMNAR.js",
12663
12684
  "kind": "import-statement"
12664
12685
  },
12665
12686
  {
@@ -12823,13 +12844,13 @@
12823
12844
  },
12824
12845
  "bytes": 36970
12825
12846
  },
12826
- "dist/chunk-O7BEFUE4.js.map": {
12847
+ "dist/chunk-YOFFMNAR.js.map": {
12827
12848
  "imports": [],
12828
12849
  "exports": [],
12829
12850
  "inputs": {},
12830
- "bytes": 3005104
12851
+ "bytes": 3006166
12831
12852
  },
12832
- "dist/chunk-O7BEFUE4.js": {
12853
+ "dist/chunk-YOFFMNAR.js": {
12833
12854
  "imports": [
12834
12855
  {
12835
12856
  "path": "react",
@@ -15047,7 +15068,7 @@
15047
15068
  "external": true
15048
15069
  },
15049
15070
  {
15050
- "path": "dist/HLSView-ZG7ZVFEM.js",
15071
+ "path": "dist/HLSView-HMMJY2KC.js",
15051
15072
  "kind": "dynamic-import"
15052
15073
  },
15053
15074
  {
@@ -15469,7 +15490,7 @@
15469
15490
  ],
15470
15491
  "inputs": {
15471
15492
  "<define:process.env>": {
15472
- "bytesInOutput": 17184
15493
+ "bytesInOutput": 17187
15473
15494
  },
15474
15495
  "../../node_modules/lodash/lodash.js": {
15475
15496
  "bytesInOutput": 224265
@@ -16075,10 +16096,13 @@
16075
16096
  "bytesInOutput": 4010
16076
16097
  },
16077
16098
  "src/Prebuilt/components/Polls/Voting/LeaderboardEntry.tsx": {
16078
- "bytesInOutput": 2075
16099
+ "bytesInOutput": 2069
16100
+ },
16101
+ "src/Prebuilt/components/Polls/common/utils.ts": {
16102
+ "bytesInOutput": 480
16079
16103
  },
16080
16104
  "src/Prebuilt/components/Polls/Voting/PeerParticipationSummary.tsx": {
16081
- "bytesInOutput": 2372
16105
+ "bytesInOutput": 2302
16082
16106
  },
16083
16107
  "src/Prebuilt/components/Polls/Voting/StatisticBox.tsx": {
16084
16108
  "bytesInOutput": 634
@@ -16093,7 +16117,7 @@
16093
16117
  "bytesInOutput": 1221
16094
16118
  },
16095
16119
  "src/Prebuilt/components/Polls/Voting/QuestionCard.jsx": {
16096
- "bytesInOutput": 7266
16120
+ "bytesInOutput": 7455
16097
16121
  },
16098
16122
  "src/Prebuilt/components/Polls/Voting/TimedVoting.tsx": {
16099
16123
  "bytesInOutput": 1028
@@ -16384,7 +16408,7 @@
16384
16408
  "bytesInOutput": 651
16385
16409
  }
16386
16410
  },
16387
- "bytes": 1220195
16411
+ "bytes": 1220903
16388
16412
  }
16389
16413
  }
16390
16414
  }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "prebuilt",
11
11
  "roomkit"
12
12
  ],
13
- "version": "0.2.2-alpha.3",
13
+ "version": "0.2.2-alpha.5",
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.2-alpha.3",
86
- "@100mslive/hms-virtual-background": "1.12.2-alpha.3",
87
- "@100mslive/react-icons": "0.9.2-alpha.3",
88
- "@100mslive/react-sdk": "0.9.2-alpha.3",
85
+ "@100mslive/hls-player": "0.2.2-alpha.5",
86
+ "@100mslive/hms-virtual-background": "1.12.2-alpha.5",
87
+ "@100mslive/react-icons": "0.9.2-alpha.5",
88
+ "@100mslive/react-sdk": "0.9.2-alpha.5",
89
89
  "@100mslive/types-prebuilt": "0.12.5",
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": "a8ba9a5b8f03574b1b398575dced298fd1a9fab5"
123
+ "gitHead": "f92ee12444119121ba670c4127c808a992a8b2c1"
124
124
  }
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { CheckCircleIcon, ClockIcon, TrophyFilledIcon } from '@100mslive/react-icons';
3
3
  import { Box, Flex } from '../../../../Layout';
4
4
  import { Text } from '../../../../Text';
5
+ import { getFormattedTime } from '../common/utils';
5
6
 
6
7
  const positionColorMap: Record<number, string> = { 1: '#D69516', 2: '#3E3E3E', 3: '#583B0F' };
7
8
 
@@ -66,7 +67,7 @@ export const LeaderboardEntry = ({
66
67
  {duration ? (
67
68
  <Flex align="center" css={{ gap: '$2', color: '$on_surface_medium' }}>
68
69
  <ClockIcon height={16} width={16} />
69
- <Text variant="xs">{(duration / 1000).toFixed(3)}s</Text>
70
+ <Text variant="xs">{getFormattedTime(duration)}</Text>
70
71
  </Flex>
71
72
  ) : null}
72
73
  </Flex>
@@ -4,6 +4,7 @@ import { Box } from '../../../../Layout';
4
4
  import { Text } from '../../../../Text';
5
5
  import { StatisticBox } from './StatisticBox';
6
6
  import { useQuizSummary } from './useQuizSummary';
7
+ import { getFormattedTime } from '../common/utils';
7
8
 
8
9
  export const PeerParticipationSummary = ({ quiz }: { quiz: HMSPoll }) => {
9
10
  const localPeerId = useHMSStore(selectLocalPeerID);
@@ -29,17 +30,17 @@ export const PeerParticipationSummary = ({ quiz }: { quiz: HMSPoll }) => {
29
30
  }/${summary.totalUsers})`,
30
31
  },
31
32
  // Time in ms
32
- { title: 'Avg. Time Taken', value: `${(summary.avgTime / 1000).toFixed(3)}s` },
33
+ { title: 'Avg. Time Taken', value: getFormattedTime(summary.avgTime) },
33
34
  {
34
35
  title: 'Avg. Score',
35
36
  value: Number.isInteger(summary.avgScore) ? summary.avgScore : summary.avgScore.toFixed(2),
36
37
  },
37
38
  ]
38
39
  : [
39
- { title: 'Your rank', value: peerEntry?.position ? `${peerEntry.position}/${summary.totalUsers}` : '-' },
40
+ { title: 'Your rank', value: peerEntry?.position || '-' },
40
41
  { title: 'Points', value: peerEntry?.score },
41
42
  // Time in ms
42
- { title: 'Time Taken', value: `${((peerEntry?.duration || 0) / 1000).toFixed(3)}s` },
43
+ { title: 'Time Taken', value: getFormattedTime(peerEntry?.duration) },
43
44
  {
44
45
  title: 'Correct Answers',
45
46
  value: peerEntry?.totalResponses ? `${peerEntry?.correctResponses}/${peerEntry.totalResponses}` : '-',
@@ -40,6 +40,7 @@ export const QuestionCard = ({
40
40
  roleCanViewResponse && (localPeerResponse || (isLocalPeerCreator && pollState === 'stopped')) && !isQuiz;
41
41
 
42
42
  const isLive = pollState === 'started';
43
+ const pollEnded = pollState === 'stopped';
43
44
  const canRespond = isLive && !localPeerResponse;
44
45
  const startTime = useRef(Date.now());
45
46
  const isCorrectAnswer = checkCorrectAnswer(answer, localPeerResponse, type);
@@ -117,8 +118,8 @@ export const QuestionCard = ({
117
118
  gap: '$4',
118
119
  }}
119
120
  >
120
- {respondedToQuiz && isCorrectAnswer ? <CheckCircleIcon height={20} width={20} /> : null}
121
- {respondedToQuiz && !isCorrectAnswer ? <CrossCircleIcon height={20} width={20} /> : null}
121
+ {respondedToQuiz && isCorrectAnswer && pollEnded ? <CheckCircleIcon height={20} width={20} /> : null}
122
+ {respondedToQuiz && !isCorrectAnswer && pollEnded ? <CrossCircleIcon height={20} width={20} /> : null}
122
123
  QUESTION {index} OF {totalQuestions}: {type.toUpperCase()}
123
124
  </Text>
124
125
  </Flex>
@@ -135,7 +136,9 @@ export const QuestionCard = ({
135
136
  </Box>
136
137
  </Flex>
137
138
 
138
- <Box css={{ maxHeight: showOptions ? '$80' : '0', transition: 'max-height 0.3s ease', overflowY: 'hidden' }}>
139
+ <Box
140
+ css={{ maxHeight: showOptions ? '$80' : '0', transition: 'max-height 0.3s ease', overflowY: 'auto', mb: '$4' }}
141
+ >
139
142
  {type === QUESTION_TYPE.SINGLE_CHOICE ? (
140
143
  <SingleChoiceOptions
141
144
  key={index}
@@ -168,19 +171,18 @@ export const QuestionCard = ({
168
171
  isStopped={pollState === 'stopped'}
169
172
  />
170
173
  ) : null}
171
-
172
- {isLive && (
173
- <QuestionActions
174
- isValidVote={isValidVote}
175
- onVote={handleVote}
176
- response={localPeerResponse}
177
- isQuiz={isQuiz}
178
- incrementIndex={() => {
179
- setCurrentIndex(curr => Math.min(totalQuestions, curr + 1));
180
- }}
181
- />
182
- )}
183
174
  </Box>
175
+ {isLive && (
176
+ <QuestionActions
177
+ isValidVote={isValidVote}
178
+ onVote={handleVote}
179
+ response={localPeerResponse}
180
+ isQuiz={isQuiz}
181
+ incrementIndex={() => {
182
+ setCurrentIndex(curr => Math.min(totalQuestions, curr + 1));
183
+ }}
184
+ />
185
+ )}
184
186
  </Box>
185
187
  );
186
188
  };
@@ -0,0 +1,16 @@
1
+ export const getFormattedTime = (milliseconds: number | undefined) => {
2
+ if (!milliseconds) return '-';
3
+
4
+ const totalSeconds = milliseconds / 1000;
5
+ const minutes = Math.floor(totalSeconds / 60);
6
+ const seconds = totalSeconds % 60;
7
+
8
+ let formattedSeconds = '';
9
+ if (Number.isInteger(seconds) || minutes) {
10
+ formattedSeconds = seconds.toFixed(0);
11
+ } else {
12
+ formattedSeconds = seconds.toFixed(1);
13
+ }
14
+
15
+ return `${minutes ? `${minutes}m ` : ''}${formattedSeconds}s`;
16
+ };