|
|
@@ -38,7 +38,7 @@ type Props = {
|
|
38
|
38
|
/**
|
|
39
|
39
|
* Whether local recording is engaged.
|
|
40
|
40
|
*/
|
|
41
|
|
- isOn: boolean,
|
|
|
41
|
+ isEngaged: boolean,
|
|
42
|
42
|
|
|
43
|
43
|
/**
|
|
44
|
44
|
* The start time of the current local recording session.
|
|
|
@@ -85,10 +85,13 @@ class LocalRecordingInfoDialog extends Component<Props, State> {
|
|
85
|
85
|
_timer: ?IntervalID;
|
|
86
|
86
|
|
|
87
|
87
|
/**
|
|
88
|
|
- * Constructor.
|
|
|
88
|
+ * Initializes a new {@code LocalRecordingInfoDialog} instance.
|
|
|
89
|
+ *
|
|
|
90
|
+ * @param {Props} props - The React {@code Component} props to initialize
|
|
|
91
|
+ * the new {@code LocalRecordingInfoDialog} instance with.
|
|
89
|
92
|
*/
|
|
90
|
|
- constructor() {
|
|
91
|
|
- super();
|
|
|
93
|
+ constructor(props: Props) {
|
|
|
94
|
+ super(props);
|
|
92
|
95
|
this.state = {
|
|
93
|
96
|
durationString: ''
|
|
94
|
97
|
};
|
|
|
@@ -134,44 +137,6 @@ class LocalRecordingInfoDialog extends Component<Props, State> {
|
|
134
|
137
|
}
|
|
135
|
138
|
}
|
|
136
|
139
|
|
|
137
|
|
-
|
|
138
|
|
- /**
|
|
139
|
|
- * Returns React elements for displaying the local recording stats of
|
|
140
|
|
- * each participant.
|
|
141
|
|
- *
|
|
142
|
|
- * @returns {ReactElement}
|
|
143
|
|
- */
|
|
144
|
|
- renderStats() {
|
|
145
|
|
- const { stats, t } = this.props;
|
|
146
|
|
-
|
|
147
|
|
- if (stats === undefined) {
|
|
148
|
|
- return <ul />;
|
|
149
|
|
- }
|
|
150
|
|
- const ids = Object.keys(stats);
|
|
151
|
|
-
|
|
152
|
|
- return (
|
|
153
|
|
- <ul>
|
|
154
|
|
- {ids.map((id, i) =>
|
|
155
|
|
-
|
|
156
|
|
- // FIXME: a workaround, as arrow functions without `return`
|
|
157
|
|
- // keyword need to be wrapped in parenthesis.
|
|
158
|
|
- /* eslint-disable no-extra-parens */
|
|
159
|
|
- (<li key = { i }>
|
|
160
|
|
- <span>{stats[id].displayName || id}: </span>
|
|
161
|
|
- <span>{stats[id].recordingStats
|
|
162
|
|
- ? `${stats[id].recordingStats.isRecording
|
|
163
|
|
- ? t('localRecording.clientState.on')
|
|
164
|
|
- : t('localRecording.clientState.off')} `
|
|
165
|
|
- + `(${stats[id]
|
|
166
|
|
- .recordingStats.currentSessionToken})`
|
|
167
|
|
- : t('localRecording.clientState.unknown')}</span>
|
|
168
|
|
- </li>)
|
|
169
|
|
- /* eslint-enable no-extra-parens */
|
|
170
|
|
- )}
|
|
171
|
|
- </ul>
|
|
172
|
|
- );
|
|
173
|
|
- }
|
|
174
|
|
-
|
|
175
|
140
|
/**
|
|
176
|
141
|
* Implements React's {@link Component#render()}.
|
|
177
|
142
|
*
|
|
|
@@ -179,8 +144,7 @@ class LocalRecordingInfoDialog extends Component<Props, State> {
|
|
179
|
144
|
* @returns {ReactElement}
|
|
180
|
145
|
*/
|
|
181
|
146
|
render() {
|
|
182
|
|
- const { isModerator, encodingFormat, isOn, t } = this.props;
|
|
183
|
|
- const { durationString } = this.state;
|
|
|
147
|
+ const { isModerator, t } = this.props;
|
|
184
|
148
|
|
|
185
|
149
|
return (
|
|
186
|
150
|
<div
|
|
|
@@ -205,57 +169,135 @@ class LocalRecordingInfoDialog extends Component<Props, State> {
|
|
205
|
169
|
: t('localRecording.no') }
|
|
206
|
170
|
</span>
|
|
207
|
171
|
</div>
|
|
208
|
|
- { isOn && <div>
|
|
209
|
|
- <span className = 'info-label'>
|
|
210
|
|
- {`${t('localRecording.duration')}:`}
|
|
211
|
|
- </span>
|
|
212
|
|
- <span className = 'spacer'> </span>
|
|
213
|
|
- <span className = 'info-value'>
|
|
214
|
|
- { durationString === ''
|
|
215
|
|
- ? t('localRecording.durationNA')
|
|
216
|
|
- : durationString }
|
|
217
|
|
- </span>
|
|
218
|
|
- </div>
|
|
219
|
|
- }
|
|
220
|
|
- {isOn
|
|
221
|
|
- && <div>
|
|
222
|
|
- <span className = 'info-label'>
|
|
223
|
|
- {`${t('localRecording.encoding')}:`}
|
|
224
|
|
- </span>
|
|
225
|
|
- <span className = 'spacer'> </span>
|
|
226
|
|
- <span className = 'info-value'>
|
|
227
|
|
- { encodingFormat }
|
|
228
|
|
- </span>
|
|
|
172
|
+ { this._renderDurationAndFormat() }
|
|
|
173
|
+ { this._renderModeratorControls() }
|
|
|
174
|
+ </div>
|
|
|
175
|
+ </div>
|
|
|
176
|
+ );
|
|
|
177
|
+ }
|
|
|
178
|
+
|
|
|
179
|
+ /**
|
|
|
180
|
+ * Renders the recording duration and encoding format. Only shown if local
|
|
|
181
|
+ * recording is engaged.
|
|
|
182
|
+ *
|
|
|
183
|
+ * @private
|
|
|
184
|
+ * @returns {ReactElement|null}
|
|
|
185
|
+ */
|
|
|
186
|
+ _renderDurationAndFormat() {
|
|
|
187
|
+ const { encodingFormat, isEngaged, t } = this.props;
|
|
|
188
|
+ const { durationString } = this.state;
|
|
|
189
|
+
|
|
|
190
|
+ if (!isEngaged) {
|
|
|
191
|
+ return null;
|
|
|
192
|
+ }
|
|
|
193
|
+
|
|
|
194
|
+ return (
|
|
|
195
|
+ <div>
|
|
|
196
|
+ <div>
|
|
|
197
|
+ <span className = 'info-label'>
|
|
|
198
|
+ {`${t('localRecording.duration')}:`}
|
|
|
199
|
+ </span>
|
|
|
200
|
+ <span className = 'spacer'> </span>
|
|
|
201
|
+ <span className = 'info-value'>
|
|
|
202
|
+ { durationString === ''
|
|
|
203
|
+ ? t('localRecording.durationNA')
|
|
|
204
|
+ : durationString }
|
|
|
205
|
+ </span>
|
|
|
206
|
+ </div>
|
|
|
207
|
+ <div>
|
|
|
208
|
+ <span className = 'info-label'>
|
|
|
209
|
+ {`${t('localRecording.encoding')}:`}
|
|
|
210
|
+ </span>
|
|
|
211
|
+ <span className = 'spacer'> </span>
|
|
|
212
|
+ <span className = 'info-value'>
|
|
|
213
|
+ { encodingFormat }
|
|
|
214
|
+ </span>
|
|
|
215
|
+ </div>
|
|
|
216
|
+ </div>
|
|
|
217
|
+ );
|
|
|
218
|
+ }
|
|
|
219
|
+
|
|
|
220
|
+ /**
|
|
|
221
|
+ * Returns React elements for displaying the local recording stats of
|
|
|
222
|
+ * each participant.
|
|
|
223
|
+ *
|
|
|
224
|
+ * @private
|
|
|
225
|
+ * @returns {ReactElement}
|
|
|
226
|
+ */
|
|
|
227
|
+ _renderStats() {
|
|
|
228
|
+ const { stats } = this.props;
|
|
|
229
|
+
|
|
|
230
|
+ if (stats === undefined) {
|
|
|
231
|
+ return <ul />;
|
|
|
232
|
+ }
|
|
|
233
|
+ const ids = Object.keys(stats);
|
|
|
234
|
+
|
|
|
235
|
+ return (
|
|
|
236
|
+ <ul>
|
|
|
237
|
+ { ids.map((id, i) => this._renderStatsLine(i, id)) }
|
|
|
238
|
+ </ul>
|
|
|
239
|
+ );
|
|
|
240
|
+ }
|
|
|
241
|
+
|
|
|
242
|
+ /**
|
|
|
243
|
+ * Renders the stats for one participant.
|
|
|
244
|
+ *
|
|
|
245
|
+ * @private
|
|
|
246
|
+ * @param {*} lineKey - The key required by React for elements in lists.
|
|
|
247
|
+ * @param {*} id - The ID of the participant.
|
|
|
248
|
+ * @returns {ReactElement}
|
|
|
249
|
+ */
|
|
|
250
|
+ _renderStatsLine(lineKey, id) {
|
|
|
251
|
+ const { stats, t } = this.props;
|
|
|
252
|
+
|
|
|
253
|
+ return (
|
|
|
254
|
+ <li key = { lineKey }>
|
|
|
255
|
+ <span>{stats[id].displayName || id}: </span>
|
|
|
256
|
+ <span>{stats[id].recordingStats
|
|
|
257
|
+ ? `${stats[id].recordingStats.isRecording
|
|
|
258
|
+ ? t('localRecording.clientState.on')
|
|
|
259
|
+ : t('localRecording.clientState.off')} `
|
|
|
260
|
+ + `(${stats[id]
|
|
|
261
|
+ .recordingStats.currentSessionToken})`
|
|
|
262
|
+ : t('localRecording.clientState.unknown')}</span>
|
|
|
263
|
+ </li>
|
|
|
264
|
+ );
|
|
|
265
|
+ }
|
|
|
266
|
+
|
|
|
267
|
+ /**
|
|
|
268
|
+ * Renders the moderator-only controls, i.e. stats of all users and the
|
|
|
269
|
+ * action links.
|
|
|
270
|
+ *
|
|
|
271
|
+ * @private
|
|
|
272
|
+ * @returns {ReactElement|null}
|
|
|
273
|
+ */
|
|
|
274
|
+ _renderModeratorControls() {
|
|
|
275
|
+ const { isModerator, isEngaged, t } = this.props;
|
|
|
276
|
+
|
|
|
277
|
+ if (!isModerator) {
|
|
|
278
|
+ return null;
|
|
|
279
|
+ }
|
|
|
280
|
+
|
|
|
281
|
+ return (
|
|
|
282
|
+ <div>
|
|
|
283
|
+ <div>
|
|
|
284
|
+ <span className = 'info-label'>
|
|
|
285
|
+ {`${t('localRecording.participantStats')}:`}
|
|
|
286
|
+ </span>
|
|
|
287
|
+ </div>
|
|
|
288
|
+ { this._renderStats() }
|
|
|
289
|
+ <div className = 'info-dialog-action-links'>
|
|
|
290
|
+ <div className = 'info-dialog-action-link'>
|
|
|
291
|
+ { isEngaged ? <a
|
|
|
292
|
+ onClick = { this._onStop }>
|
|
|
293
|
+ { t('localRecording.stop') }
|
|
|
294
|
+ </a>
|
|
|
295
|
+ : <a
|
|
|
296
|
+ onClick = { this._onStart }>
|
|
|
297
|
+ { t('localRecording.start') }
|
|
|
298
|
+ </a>
|
|
|
299
|
+ }
|
|
229
|
300
|
</div>
|
|
230
|
|
- }
|
|
231
|
|
- {
|
|
232
|
|
- isModerator
|
|
233
|
|
- && <div>
|
|
234
|
|
- <div>
|
|
235
|
|
- <span className = 'info-label'>
|
|
236
|
|
- {`${t('localRecording.participantStats')}:`}
|
|
237
|
|
- </span>
|
|
238
|
|
- </div>
|
|
239
|
|
- { this.renderStats() }
|
|
240
|
|
- </div>
|
|
241
|
|
- }
|
|
242
|
|
- {
|
|
243
|
|
- isModerator
|
|
244
|
|
- && <div className = 'info-dialog-action-links'>
|
|
245
|
|
- <div className = 'info-dialog-action-link'>
|
|
246
|
|
- {isOn ? <a
|
|
247
|
|
- onClick = { this._onStop }>
|
|
248
|
|
- { t('localRecording.stop') }
|
|
249
|
|
- </a>
|
|
250
|
|
- : <a
|
|
251
|
|
- onClick = { this._onStart }>
|
|
252
|
|
- { t('localRecording.start') }
|
|
253
|
|
- </a>
|
|
254
|
|
-
|
|
255
|
|
- }
|
|
256
|
|
- </div>
|
|
257
|
|
- </div>
|
|
258
|
|
- }
|
|
259
|
301
|
</div>
|
|
260
|
302
|
</div>
|
|
261
|
303
|
);
|
|
|
@@ -311,7 +353,7 @@ class LocalRecordingInfoDialog extends Component<Props, State> {
|
|
311
|
353
|
* @returns {{
|
|
312
|
354
|
* encodingFormat: string,
|
|
313
|
355
|
* isModerator: boolean,
|
|
314
|
|
- * isOn: boolean,
|
|
|
356
|
+ * isEngaged: boolean,
|
|
315
|
357
|
* recordingEngagedAt: Date,
|
|
316
|
358
|
* stats: Object
|
|
317
|
359
|
* }}
|
|
|
@@ -319,7 +361,7 @@ class LocalRecordingInfoDialog extends Component<Props, State> {
|
|
319
|
361
|
function _mapStateToProps(state) {
|
|
320
|
362
|
const {
|
|
321
|
363
|
encodingFormat,
|
|
322
|
|
- isEngaged: isOn,
|
|
|
364
|
+ isEngaged,
|
|
323
|
365
|
recordingEngagedAt,
|
|
324
|
366
|
stats
|
|
325
|
367
|
} = state['features/local-recording'];
|
|
|
@@ -329,7 +371,7 @@ function _mapStateToProps(state) {
|
|
329
|
371
|
return {
|
|
330
|
372
|
encodingFormat,
|
|
331
|
373
|
isModerator,
|
|
332
|
|
- isOn,
|
|
|
374
|
+ isEngaged,
|
|
333
|
375
|
recordingEngagedAt,
|
|
334
|
376
|
stats
|
|
335
|
377
|
};
|