Browse Source

ref(Conference): extract AbstractConference

master
paweldomas 6 years ago
parent
commit
15fd27543a

+ 40
- 0
react/features/conference/components/AbstractConference.js View File

1
+// @flow
2
+
3
+import { shouldDisplayTileView } from '../../video-layout';
4
+
5
+/**
6
+ * The type of the React {@code Component} props of {@link AbstractLabels}.
7
+ */
8
+export type AbstractProps = {
9
+
10
+    /**
11
+     * Conference room name.
12
+     *
13
+     * @protected
14
+     * @type {string}
15
+     */
16
+    _room: string,
17
+
18
+    /**
19
+     * Whether or not the layout should change to support tile view mode.
20
+     *
21
+     * @protected
22
+     * @type {boolean}
23
+     */
24
+    _shouldDisplayTileView: boolean
25
+};
26
+
27
+/**
28
+ * Maps (parts of) the redux state to the associated props of the {@link Labels}
29
+ * {@code Component}.
30
+ *
31
+ * @param {Object} state - The redux state.
32
+ * @private
33
+ * @returns {AbstractProps}
34
+ */
35
+export function abstractMapStateToProps(state: Object) {
36
+    return {
37
+        _room: state['features/base/conference'].room,
38
+        _shouldDisplayTileView: shouldDisplayTileView(state)
39
+    };
40
+}

+ 8
- 44
react/features/conference/components/native/Conference.js View File

25
 import { AddPeopleDialog, CalleeInfoContainer } from '../../../invite';
25
 import { AddPeopleDialog, CalleeInfoContainer } from '../../../invite';
26
 import { Captions } from '../../../subtitles';
26
 import { Captions } from '../../../subtitles';
27
 import { setToolboxVisible, Toolbox } from '../../../toolbox';
27
 import { setToolboxVisible, Toolbox } from '../../../toolbox';
28
-import { shouldDisplayTileView } from '../../../video-layout';
29
 
28
 
29
+import { abstractMapStateToProps } from '../AbstractConference';
30
 import DisplayNameLabel from './DisplayNameLabel';
30
 import DisplayNameLabel from './DisplayNameLabel';
31
 import Labels from './Labels';
31
 import Labels from './Labels';
32
 import NavigationBar from './NavigationBar';
32
 import NavigationBar from './NavigationBar';
33
 import styles from './styles';
33
 import styles from './styles';
34
 
34
 
35
+import type { AbstractProps } from '../AbstractConference';
36
+
35
 /**
37
 /**
36
  * The type of the React {@code Component} props of {@link Conference}.
38
  * The type of the React {@code Component} props of {@link Conference}.
37
  */
39
  */
38
-type Props = {
40
+type Props = AbstractProps & {
39
 
41
 
40
     /**
42
     /**
41
      * The indicator which determines that we are still connecting to the
43
      * The indicator which determines that we are still connecting to the
103
      */
105
      */
104
     _reducedUI: boolean,
106
     _reducedUI: boolean,
105
 
107
 
106
-    /**
107
-     * The current conference room name.
108
-     *
109
-     * @private
110
-     */
111
-    _room: string,
112
-
113
     /**
108
     /**
114
      * The handler which dispatches the (redux) action {@link setToolboxVisible}
109
      * The handler which dispatches the (redux) action {@link setToolboxVisible}
115
      * to show/hide the {@link Toolbox}.
110
      * to show/hide the {@link Toolbox}.
121
      */
116
      */
122
     _setToolboxVisible: Function,
117
     _setToolboxVisible: Function,
123
 
118
 
124
-    /**
125
-     * Whether or not the layout should change to support tile view mode.
126
-     *
127
-     * @private
128
-     */
129
-    _shouldDisplayTileView: boolean,
130
-
131
     /**
119
     /**
132
      * The indicator which determines whether the Toolbox is visible.
120
      * The indicator which determines whether the Toolbox is visible.
133
      *
121
      *
424
  *
412
  *
425
  * @param {Object} state - The redux state.
413
  * @param {Object} state - The redux state.
426
  * @private
414
  * @private
427
- * @returns {{
428
- *     _connecting: boolean,
429
- *     _filmstripVisible: boolean,
430
- *     _locationURL: URL,
431
- *     _participantCount: number,
432
- *     _reducedUI: boolean,
433
- *     _room: string,
434
- *     _toolboxVisible: boolean,
435
- *     _toolboxAlwaysVisible: boolean
436
- * }}
415
+ * @returns {Props}
437
  */
416
  */
438
 function _mapStateToProps(state) {
417
 function _mapStateToProps(state) {
439
     const { connecting, connection, locationURL }
418
     const { connecting, connection, locationURL }
441
     const {
420
     const {
442
         conference,
421
         conference,
443
         joining,
422
         joining,
444
-        leaving,
445
-        room
423
+        leaving
446
     } = state['features/base/conference'];
424
     } = state['features/base/conference'];
447
     const { reducedUI } = state['features/base/responsive-ui'];
425
     const { reducedUI } = state['features/base/responsive-ui'];
448
     const { alwaysVisible, visible } = state['features/toolbox'];
426
     const { alwaysVisible, visible } = state['features/toolbox'];
460
         = connecting || (connection && (joining || (!conference && !leaving)));
438
         = connecting || (connection && (joining || (!conference && !leaving)));
461
 
439
 
462
     return {
440
     return {
441
+        ...abstractMapStateToProps(state),
442
+
463
         /**
443
         /**
464
          * The indicator which determines that we are still connecting to the
444
          * The indicator which determines that we are still connecting to the
465
          * conference which includes establishing the XMPP connection and then
445
          * conference which includes establishing the XMPP connection and then
501
          */
481
          */
502
         _reducedUI: reducedUI,
482
         _reducedUI: reducedUI,
503
 
483
 
504
-        /**
505
-         * The current conference room name.
506
-         *
507
-         * @private
508
-         * @type {string}
509
-         */
510
-        _room: room,
511
-
512
-        /**
513
-         * Whether or not the layout should change to support tile view mode.
514
-         *
515
-         * @private
516
-         * @type {boolean}
517
-         */
518
-        _shouldDisplayTileView: shouldDisplayTileView(state),
519
-
520
         /**
484
         /**
521
          * The indicator which determines whether the Toolbox is visible.
485
          * The indicator which determines whether the Toolbox is visible.
522
          *
486
          *

+ 8
- 25
react/features/conference/components/web/Conference.js View File

14
 import { CalleeInfoContainer } from '../../../invite';
14
 import { CalleeInfoContainer } from '../../../invite';
15
 import { LargeVideo } from '../../../large-video';
15
 import { LargeVideo } from '../../../large-video';
16
 import { NotificationsContainer } from '../../../notifications';
16
 import { NotificationsContainer } from '../../../notifications';
17
-import {
18
-    LAYOUTS,
19
-    getCurrentLayout,
20
-    shouldDisplayTileView
21
-} from '../../../video-layout';
17
+import { LAYOUTS, getCurrentLayout } from '../../../video-layout';
22
 
18
 
23
 import {
19
 import {
24
     Toolbox,
20
     Toolbox,
32
 import Labels from './Labels';
28
 import Labels from './Labels';
33
 import { default as Notice } from './Notice';
29
 import { default as Notice } from './Notice';
34
 import { default as Subject } from './Subject';
30
 import { default as Subject } from './Subject';
31
+import { abstractMapStateToProps } from '../AbstractConference';
32
+
33
+import type { AbstractProps } from '../AbstractConference';
35
 
34
 
36
 declare var APP: Object;
35
 declare var APP: Object;
37
 declare var config: Object;
36
 declare var config: Object;
68
 /**
67
 /**
69
  * The type of the React {@code Component} props of {@link Conference}.
68
  * The type of the React {@code Component} props of {@link Conference}.
70
  */
69
  */
71
-type Props = {
70
+type Props = AbstractProps & {
72
 
71
 
73
     /**
72
     /**
74
      * Whether the local participant is recording the conference.
73
      * Whether the local participant is recording the conference.
81
      */
80
      */
82
     _layoutClassName: string,
81
     _layoutClassName: string,
83
 
82
 
84
-    /**
85
-     * Conference room name.
86
-     */
87
-    _room: string,
88
-
89
-    /**
90
-     * Whether or not the current UI layout should be in tile view.
91
-     */
92
-    _shouldDisplayTileView: boolean,
93
-
94
     dispatch: Function,
83
     dispatch: Function,
95
     t: Function
84
     t: Function
96
 }
85
 }
290
  *
279
  *
291
  * @param {Object} state - The Redux state.
280
  * @param {Object} state - The Redux state.
292
  * @private
281
  * @private
293
- * @returns {{
294
- *     _iAmRecorder: boolean,
295
- *     _layoutClassName: string,
296
- *     _room: ?string,
297
- *     _shouldDisplayTileView: boolean
298
- * }}
282
+ * @returns {Props}
299
  */
283
  */
300
 function _mapStateToProps(state) {
284
 function _mapStateToProps(state) {
301
     const currentLayout = getCurrentLayout(state);
285
     const currentLayout = getCurrentLayout(state);
302
 
286
 
303
     return {
287
     return {
288
+        ...abstractMapStateToProps(state),
304
         _iAmRecorder: state['features/base/config'].iAmRecorder,
289
         _iAmRecorder: state['features/base/config'].iAmRecorder,
305
-        _layoutClassName: LAYOUT_CLASSNAMES[currentLayout],
306
-        _room: state['features/base/conference'].room,
307
-        _shouldDisplayTileView: shouldDisplayTileView(state)
290
+        _layoutClassName: LAYOUT_CLASSNAMES[currentLayout]
308
     };
291
     };
309
 }
292
 }
310
 
293
 

Loading…
Cancel
Save