Просмотр исходного кода

[RN] Add ability to enable / disable the filmstrip (Coding style: comments, naming)

master
Lyubo Marinov 7 лет назад
Родитель
Сommit
240fff74c7

+ 2
- 2
react/features/conference/components/Conference.native.js Просмотреть файл

@@ -355,9 +355,9 @@ function _mapDispatchToProps(dispatch) {
355 355
 }
356 356
 
357 357
 /**
358
- * Maps (parts of) the Redux state to the associated Conference's props.
358
+ * Maps (parts of) the redux state to the associated {@code Conference}'s props.
359 359
  *
360
- * @param {Object} state - The Redux state.
360
+ * @param {Object} state - The redux state.
361 361
  * @private
362 362
  * @returns {{
363 363
  *     _connecting: boolean,

+ 9
- 9
react/features/conference/components/Conference.web.js Просмотреть файл

@@ -25,9 +25,9 @@ declare var interfaceConfig: Object;
25 25
 type Props = {
26 26
 
27 27
     /**
28
-     * Whether or not the current local user is recording the conference.
28
+     * Whether the local participant is recording the conference.
29 29
      */
30
-    _isRecording: boolean,
30
+    _iAmRecorder: boolean,
31 31
 
32 32
     dispatch: Function,
33 33
     t: Function
@@ -102,9 +102,10 @@ class Conference extends Component<Props> {
102 102
      */
103 103
     render() {
104 104
         const { filmStripOnly, VIDEO_QUALITY_LABEL_DISABLED } = interfaceConfig;
105
-        const hideVideoQualityLabel = filmStripOnly
106
-            || VIDEO_QUALITY_LABEL_DISABLED
107
-            || this.props._isRecording;
105
+        const hideVideoQualityLabel
106
+            = filmStripOnly
107
+                || VIDEO_QUALITY_LABEL_DISABLED
108
+                || this.props._iAmRecorder;
108 109
 
109 110
         return (
110 111
             <div
@@ -153,18 +154,17 @@ class Conference extends Component<Props> {
153 154
  * @param {Object} state - The Redux state.
154 155
  * @private
155 156
  * @returns {{
156
- *     _isRecording: boolean
157
+ *     _iAmRecorder: boolean
157 158
  * }}
158 159
  */
159 160
 function _mapStateToProps(state) {
160 161
     return {
161 162
         /**
162
-         * Indicates if the current user is recording the conference, ie, they
163
-         * are a recorder.
163
+         * Whether the local participant is recording the conference.
164 164
          *
165 165
          * @private
166 166
          */
167
-        _isRecording: state['features/base/config'].iAmRecorder
167
+        _iAmRecorder: state['features/base/config'].iAmRecorder
168 168
     };
169 169
 }
170 170
 

+ 2
- 3
react/features/filmstrip/actionTypes.js Просмотреть файл

@@ -1,6 +1,5 @@
1 1
 /**
2
- * The type of (redux) action which sets whether the filmstrip is enabled or
3
- * not.
2
+ * The type of (redux) action which sets whether the filmstrip is enabled.
4 3
  *
5 4
  * {
6 5
  *     type: SET_FILMSTRIP_ENABLED,
@@ -21,7 +20,7 @@ export const SET_FILMSTRIP_ENABLED = Symbol('SET_FILMSTRIP_ENABLED');
21 20
 export const SET_FILMSTRIP_HOVERED = Symbol('SET_FILMSTRIP_HOVERED');
22 21
 
23 22
 /**
24
- * The type of (redux) action which sets the visibility of the filmstrip.
23
+ * The type of (redux) action which sets whether the filmstrip is visible.
25 24
  *
26 25
  * {
27 26
  *     type: SET_FILMSTRIP_VISIBLE,

+ 11
- 10
react/features/filmstrip/actions.js Просмотреть файл

@@ -1,3 +1,5 @@
1
+// @flow
2
+
1 3
 import {
2 4
     SET_FILMSTRIP_ENABLED,
3 5
     SET_FILMSTRIP_HOVERED,
@@ -5,15 +7,15 @@ import {
5 7
 } from './actionTypes';
6 8
 
7 9
 /**
8
- * Sets if the filmstrip should be enabled.
10
+ * Sets whether the filmstrip is enabled.
9 11
  *
10
- * @param {boolean} enabled - Whether the filmstrip should be enabled.
12
+ * @param {boolean} enabled - Whether the filmstrip is enabled.
11 13
  * @returns {{
12 14
  *     type: SET_FILMSTRIP_ENABLED,
13 15
  *     enabled: boolean
14 16
  * }}
15 17
  */
16
-export function setFilmstripEnabled(enabled) {
18
+export function setFilmstripEnabled(enabled: boolean) {
17 19
     return {
18 20
         type: SET_FILMSTRIP_ENABLED,
19 21
         enabled
@@ -21,16 +23,15 @@ export function setFilmstripEnabled(enabled) {
21 23
 }
22 24
 
23 25
 /**
24
- * Sets if the filmstrip is currently being hovered over.
26
+ * Sets whether the filmstrip is being hovered (over).
25 27
  *
26
- * @param {boolean} hovered - Whether or not the filmstrip is currently being
27
- * hovered over.
28
+ * @param {boolean} hovered - Whether the filmstrip is being hovered (over).
28 29
  * @returns {{
29 30
  *     type: SET_FILMSTRIP_HOVERED,
30 31
  *     hovered: boolean
31 32
  * }}
32 33
  */
33
-export function setFilmstripHovered(hovered) {
34
+export function setFilmstripHovered(hovered: boolean) {
34 35
     return {
35 36
         type: SET_FILMSTRIP_HOVERED,
36 37
         hovered
@@ -38,15 +39,15 @@ export function setFilmstripHovered(hovered) {
38 39
 }
39 40
 
40 41
 /**
41
- * Sets if the filmstrip should be visible.
42
+ * Sets whether the filmstrip is visible.
42 43
  *
43
- * @param {boolean} visible - Whether the filmstrip should be visible.
44
+ * @param {boolean} visible - Whether the filmstrip is visible.
44 45
  * @returns {{
45 46
  *     type: SET_FILMSTRIP_VISIBLE,
46 47
  *     visible: boolean
47 48
  * }}
48 49
  */
49
-export function setFilmstripVisible(visible) {
50
+export function setFilmstripVisible(visible: boolean) {
50 51
     return {
51 52
         type: SET_FILMSTRIP_VISIBLE,
52 53
         visible

+ 7
- 8
react/features/filmstrip/components/Filmstrip.native.js Просмотреть файл

@@ -10,7 +10,7 @@ import {
10 10
     makeAspectRatioAware
11 11
 } from '../../base/responsive-ui';
12 12
 
13
-import { styles } from './_';
13
+import styles from './styles';
14 14
 import Thumbnail from './Thumbnail';
15 15
 
16 16
 /**
@@ -63,14 +63,11 @@ class Filmstrip extends Component<Props> {
63 63
             = isNarrowAspectRatio_
64 64
                 ? styles.filmstripNarrow
65 65
                 : styles.filmstripWide;
66
-        const {
67
-            _participants: participants,
68
-            _visible: visible } = this.props;
69 66
 
70 67
         return (
71 68
             <Container
72 69
                 style = { filmstripStyle }
73
-                visible = { visible }>
70
+                visible = { this.props._visible }>
74 71
                 <ScrollView
75 72
                     horizontal = { isNarrowAspectRatio_ }
76 73
                     showsHorizontalScrollIndicator = { false }
@@ -78,7 +75,9 @@ class Filmstrip extends Component<Props> {
78 75
                     {
79 76
                         /* eslint-disable react/jsx-wrap-multilines */
80 77
 
81
-                        this._sort(participants, isNarrowAspectRatio_)
78
+                        this._sort(
79
+                                this.props._participants,
80
+                                isNarrowAspectRatio_)
82 81
                             .map(p =>
83 82
                                 <Thumbnail
84 83
                                     key = { p.id }
@@ -127,9 +126,9 @@ class Filmstrip extends Component<Props> {
127 126
 }
128 127
 
129 128
 /**
130
- * Function that maps parts of Redux state tree into component props.
129
+ * Maps (parts of) the redux state to the associated {@code Filmstrip}'s props.
131 130
  *
132
- * @param {Object} state - Redux state.
131
+ * @param {Object} state - The redux state.
133 132
  * @private
134 133
  * @returns {{
135 134
  *     _participants: Participant[],

+ 23
- 0
react/features/filmstrip/reducer.js Просмотреть файл

@@ -1,3 +1,5 @@
1
+// @flow
2
+
1 3
 import { ReducerRegistry } from '../base/redux';
2 4
 
3 5
 import {
@@ -7,7 +9,20 @@ import {
7 9
 } from './actionTypes';
8 10
 
9 11
 const DEFAULT_STATE = {
12
+    /**
13
+     * The indicator which determines whether the {@link Filmstrip} is enabled.
14
+     *
15
+     * @public
16
+     * @type {boolean}
17
+     */
10 18
     enabled: true,
19
+
20
+    /**
21
+     * The indicator which determines whether the {@link Filmstrip} is visible.
22
+     *
23
+     * @public
24
+     * @type {boolean}
25
+     */
11 26
     visible: true
12 27
 };
13 28
 
@@ -24,6 +39,14 @@ ReducerRegistry.register(
24 39
         case SET_FILMSTRIP_HOVERED:
25 40
             return {
26 41
                 ...state,
42
+
43
+                /**
44
+                 * The indicator which determines whether the {@link Filmstrip}
45
+                 * is being hovered (over).
46
+                 *
47
+                 * @public
48
+                 * @type {boolean}
49
+                 */
27 50
                 hovered: action.hovered
28 51
             };
29 52
 

Загрузка…
Отмена
Сохранить