Browse Source

[RN] Add UI for raised hand feature

master
Bettenbuk Zoltan 6 years ago
parent
commit
e65918564b

+ 4
- 1
modules/UI/videolayout/SmallVideo.js View File

@@ -824,6 +824,7 @@ SmallVideo.prototype.updateIndicators = function() {
824 824
     }
825 825
 
826 826
     ReactDOM.render(
827
+        <Provider store = { APP.store }>
827 828
             <I18nextProvider i18n = { i18next }>
828 829
                 <div>
829 830
                     <AtlasKitThemeProvider mode = 'dark'>
@@ -842,6 +843,7 @@ SmallVideo.prototype.updateIndicators = function() {
842 843
                         { this._showRaisedHand
843 844
                             ? <RaisedHandIndicator
844 845
                                 iconSize = { iconSize }
846
+                                participantId = { this.id }
845 847
                                 tooltipPosition = { tooltipPosition } />
846 848
                             : null }
847 849
                         { this._showDominantSpeaker
@@ -851,7 +853,8 @@ SmallVideo.prototype.updateIndicators = function() {
851 853
                             : null }
852 854
                     </AtlasKitThemeProvider>
853 855
                 </div>
854
-            </I18nextProvider>,
856
+            </I18nextProvider>
857
+        </Provider>,
855 858
         indicatorToolbar
856 859
     );
857 860
 };

+ 42
- 0
react/features/filmstrip/components/AbstractRaisedHandIndicator.js View File

@@ -0,0 +1,42 @@
1
+// @flow
2
+
3
+import { Component } from 'react';
4
+
5
+import { getParticipantById } from '../../base/participants';
6
+
7
+export type Props = {
8
+
9
+    /**
10
+     * The participant id who we want to render the raised hand indicator
11
+     * for.
12
+     */
13
+    participantId: string,
14
+
15
+    /**
16
+     * True if the hand is raised for this participant.
17
+     */
18
+    _raisedHand: boolean
19
+}
20
+
21
+/**
22
+ * Implements an abstract class for the RaisedHandIndicator component.
23
+ */
24
+export default class AbstractRaisedHandIndicator<P: Props>
25
+    extends Component<P> {
26
+
27
+}
28
+
29
+/**
30
+ * Maps part of the Redux state to the props of this component.
31
+ *
32
+ * @param {Object} state - The Redux state.
33
+ * @param {Props} ownProps - The own props of the component.
34
+ * @returns {Object}
35
+ */
36
+export function _mapStateToProps(state: Object, ownProps: Props): Object {
37
+    const participant = getParticipantById(state, ownProps.participantId);
38
+
39
+    return {
40
+        _raisedHand: participant && participant.raisedHand
41
+    };
42
+}

+ 5
- 3
react/features/filmstrip/components/native/DominantSpeakerIndicator.js View File

@@ -1,3 +1,5 @@
1
+// @flow
2
+
1 3
 import React, { Component } from 'react';
2 4
 import { View } from 'react-native';
3 5
 
@@ -9,7 +11,7 @@ import styles from './styles';
9 11
  * Thumbnail badge showing that the participant is the dominant speaker in
10 12
  * the conference.
11 13
  */
12
-export default class DominantSpeakerIndicator extends Component {
14
+export default class DominantSpeakerIndicator extends Component<{}> {
13 15
     /**
14 16
      * Implements React's {@link Component#render()}.
15 17
      *
@@ -17,10 +19,10 @@ export default class DominantSpeakerIndicator extends Component {
17 19
      */
18 20
     render() {
19 21
         return (
20
-            <View style = { styles.dominantSpeakerIndicatorBackground }>
22
+            <View style = { styles.indicatorBackground }>
21 23
                 <Icon
22 24
                     name = 'dominant-speaker'
23
-                    style = { styles.dominantSpeakerIndicator } />
25
+                    style = { styles.indicator } />
24 26
             </View>
25 27
         );
26 28
     }

+ 1
- 1
react/features/filmstrip/components/native/LocalThumbnail.js View File

@@ -6,7 +6,7 @@ import { View } from 'react-native';
6 6
 import { getLocalParticipant } from '../../../base/participants';
7 7
 import { connect } from '../../../base/redux';
8 8
 
9
-import styles from '../styles';
9
+import styles from './styles';
10 10
 import Thumbnail from './Thumbnail';
11 11
 
12 12
 type Props = {

+ 42
- 0
react/features/filmstrip/components/native/RaisedHandIndicator.js View File

@@ -0,0 +1,42 @@
1
+/* @flow */
2
+
3
+import React from 'react';
4
+import { View } from 'react-native';
5
+
6
+import { Icon } from '../../../base/font-icons';
7
+import { connect } from '../../../base/redux';
8
+
9
+import AbstractRaisedHandIndicator, {
10
+    type Props,
11
+    _mapStateToProps
12
+} from '../AbstractRaisedHandIndicator';
13
+
14
+import styles from './styles';
15
+
16
+/**
17
+ * Thumbnail badge showing that the participant would like to speak.
18
+ *
19
+ * @extends Component
20
+ */
21
+class RaisedHandIndicator extends AbstractRaisedHandIndicator<Props> {
22
+    /**
23
+     * Implements React's {@link Component#render()}.
24
+     *
25
+     * @inheritdoc
26
+     */
27
+    render() {
28
+        if (!this.props._raisedHand) {
29
+            return null;
30
+        }
31
+
32
+        return (
33
+            <View style = { styles.indicatorBackground }>
34
+                <Icon
35
+                    name = 'raised-hand'
36
+                    style = { styles.indicator } />
37
+            </View>
38
+        );
39
+    }
40
+}
41
+
42
+export default connect(_mapStateToProps)(RaisedHandIndicator);

+ 4
- 2
react/features/filmstrip/components/native/Thumbnail.js View File

@@ -22,8 +22,8 @@ import { RemoteVideoMenu } from '../../../remote-video-menu';
22 22
 import AudioMutedIndicator from './AudioMutedIndicator';
23 23
 import DominantSpeakerIndicator from './DominantSpeakerIndicator';
24 24
 import ModeratorIndicator from './ModeratorIndicator';
25
-import { AVATAR_SIZE } from '../styles';
26
-import styles from './styles';
25
+import RaisedHandIndicator from './RaisedHandIndicator';
26
+import styles, { AVATAR_SIZE } from './styles';
27 27
 import VideoMutedIndicator from './VideoMutedIndicator';
28 28
 
29 29
 /**
@@ -168,6 +168,8 @@ class Thumbnail extends Component<Props> {
168 168
                 { participant.dominantSpeaker
169 169
                     && <DominantSpeakerIndicator /> }
170 170
 
171
+                <RaisedHandIndicator participantId = { participant.id } />
172
+
171 173
                 <Container style = { styles.thumbnailIndicatorContainer }>
172 174
                     { audioMuted
173 175
                         && <AudioMutedIndicator /> }

+ 155
- 10
react/features/filmstrip/components/native/styles.js View File

@@ -1,6 +1,14 @@
1
-import { ColorPalette, createStyleSheet } from '../../../base/styles';
1
+// @flow
2 2
 
3
-import { default as platformIndependentStyles } from '../styles';
3
+import { ColorSchemeRegistry, schemeColor } from '../../../base/color-scheme';
4
+import { ColorPalette } from '../../../base/styles';
5
+
6
+import { FILMSTRIP_SIZE } from '../../constants';
7
+
8
+/**
9
+ * Size for the Avatar.
10
+ */
11
+export const AVATAR_SIZE = 50;
4 12
 
5 13
 /**
6 14
  * The base/default style of indicators such as audioMutedIndicator,
@@ -17,34 +25,171 @@ const indicator = {
17 25
 /**
18 26
  * The styles of the feature filmstrip.
19 27
  */
20
-export default createStyleSheet(platformIndependentStyles, {
21
-    dominantSpeakerIndicator: {
28
+export default {
29
+    /**
30
+     * Dominant speaker indicator style.
31
+     */
32
+    indicator: {
33
+        color: ColorPalette.white,
22 34
         fontSize: 12
23 35
     },
24 36
 
25 37
     /**
26 38
      * Dominant speaker indicator background style.
27 39
      */
28
-    dominantSpeakerIndicatorBackground: {
40
+    indicatorBackground: {
41
+        backgroundColor: ColorPalette.blue,
29 42
         borderRadius: 16,
30
-        padding: 4
43
+        left: 4,
44
+        padding: 4,
45
+        position: 'absolute',
46
+        top: 4
47
+    },
48
+
49
+    /**
50
+     * The style of the narrow {@link Filmstrip} version which displays
51
+     * thumbnails in a row at the bottom of the screen.
52
+     */
53
+    filmstripNarrow: {
54
+        flexDirection: 'row',
55
+        flexGrow: 0,
56
+        justifyContent: 'flex-end',
57
+        height: FILMSTRIP_SIZE
58
+    },
59
+
60
+    /**
61
+     * The style of the wide {@link Filmstrip} version which displays thumbnails
62
+     * in a column on the short size of the screen.
63
+     *
64
+     * NOTE: width is calculated based on the children, but it should also align
65
+     * to {@code FILMSTRIP_SIZE}.
66
+     */
67
+    filmstripWide: {
68
+        bottom: 0,
69
+        flexDirection: 'column',
70
+        flexGrow: 0,
71
+        position: 'absolute',
72
+        right: 0,
73
+        top: 0
74
+    },
75
+
76
+    /**
77
+     * Container of the {@link LocalThumbnail}.
78
+     */
79
+    localThumbnail: {
80
+        alignContent: 'stretch',
81
+        alignSelf: 'stretch',
82
+        aspectRatio: 1,
83
+        flexShrink: 0,
84
+        flexDirection: 'row'
31 85
     },
32 86
 
33 87
     /**
34 88
      * Moderator indicator style.
35 89
      */
36
-    moderatorIndicator: indicator,
90
+    moderatorIndicator: {
91
+        backgroundColor: 'transparent',
92
+        bottom: 4,
93
+        color: ColorPalette.white,
94
+        position: 'absolute',
95
+        right: 4,
96
+        ...indicator
97
+    },
98
+
99
+    /**
100
+     * The style of the scrollview containing the remote thumbnails.
101
+     */
102
+    scrollView: {
103
+        flexGrow: 0
104
+    },
37 105
 
38 106
     /**
39
-     * Video thumbnail style.
107
+     * The style of a participant's Thumbnail which renders either the video or
108
+     * the avatar of the associated participant.
40 109
      */
41 110
     thumbnail: {
111
+        alignItems: 'stretch',
112
+        backgroundColor: ColorPalette.appBackground,
113
+        borderColor: '#424242',
114
+        borderRadius: 3,
115
+        borderStyle: 'solid',
116
+        borderWidth: 1,
117
+        flex: 1,
42 118
         height: 80,
119
+        justifyContent: 'center',
120
+        margin: 2,
121
+        overflow: 'hidden',
122
+        position: 'relative',
43 123
         width: 80
44 124
     },
45 125
 
46 126
     /**
47
-     * Audio muted indicator style.
127
+     * The thumbnail audio and video muted indicator style.
128
+     */
129
+    thumbnailIndicator: {
130
+        backgroundColor: 'transparent',
131
+        color: ColorPalette.white,
132
+        paddingLeft: 1,
133
+        paddingRight: 1,
134
+        position: 'relative',
135
+        ...indicator
136
+    },
137
+
138
+    /**
139
+     * The thumbnails indicator container.
48 140
      */
49
-    thumbnailIndicator: indicator
141
+    thumbnailIndicatorContainer: {
142
+        alignSelf: 'stretch',
143
+        bottom: 4,
144
+        flex: 1,
145
+        flexDirection: 'row',
146
+        left: 4,
147
+        position: 'absolute'
148
+    },
149
+
150
+    tileView: {
151
+        alignSelf: 'center'
152
+    },
153
+
154
+    tileViewRows: {
155
+        justifyContent: 'center'
156
+    },
157
+
158
+    tileViewRow: {
159
+        flexDirection: 'row',
160
+        justifyContent: 'center'
161
+    }
162
+};
163
+
164
+/**
165
+ * Color schemed styles for the @{code Thumbnail} component.
166
+ */
167
+ColorSchemeRegistry.register('Thumbnail', {
168
+
169
+    /**
170
+     * Tinting style of the on-stage participant thumbnail.
171
+     */
172
+    activeThumbnailTint: {
173
+        backgroundColor: schemeColor('activeParticipantTint')
174
+    },
175
+
176
+    /**
177
+     * Coloring if the thumbnail background.
178
+     */
179
+    participantViewStyle: {
180
+        backgroundColor: schemeColor('background')
181
+    },
182
+
183
+    /**
184
+     * Pinned video thumbnail style.
185
+     */
186
+    thumbnailPinned: {
187
+        borderColor: schemeColor('activeParticipantHighlight'),
188
+        shadowColor: schemeColor('activeParticipantHighlight'),
189
+        shadowOffset: {
190
+            height: 5,
191
+            width: 5
192
+        },
193
+        shadowRadius: 5
194
+    }
50 195
 });

+ 0
- 185
react/features/filmstrip/components/styles.js View File

@@ -1,185 +0,0 @@
1
-// @flow
2
-
3
-import { ColorSchemeRegistry, schemeColor } from '../../base/color-scheme';
4
-import { ColorPalette } from '../../base/styles';
5
-import { FILMSTRIP_SIZE } from '../constants';
6
-
7
-/**
8
- * Size for the Avatar.
9
- */
10
-export const AVATAR_SIZE = 50;
11
-
12
-/**
13
- * The base style of {@link Filmstrip} shared between narrow and wide versions.
14
- */
15
-const filmstrip = {
16
-    flexGrow: 0
17
-};
18
-
19
-/**
20
- * The styles of the feature filmstrip common to both Web and native.
21
- */
22
-export default {
23
-    /**
24
-     * Dominant speaker indicator style.
25
-     */
26
-    dominantSpeakerIndicator: {
27
-        color: ColorPalette.white,
28
-        fontSize: 15
29
-    },
30
-
31
-    /**
32
-     * Dominant speaker indicator background style.
33
-     */
34
-    dominantSpeakerIndicatorBackground: {
35
-        backgroundColor: ColorPalette.blue,
36
-        borderRadius: 15,
37
-        left: 4,
38
-        padding: 5,
39
-        position: 'absolute',
40
-        top: 4
41
-    },
42
-
43
-    /**
44
-     * The style of the narrow {@link Filmstrip} version which displays
45
-     * thumbnails in a row at the bottom of the screen.
46
-     */
47
-    filmstripNarrow: {
48
-        ...filmstrip,
49
-        flexDirection: 'row',
50
-        justifyContent: 'flex-end',
51
-        height: FILMSTRIP_SIZE
52
-    },
53
-
54
-    /**
55
-     * The style of the wide {@link Filmstrip} version which displays thumbnails
56
-     * in a column on the short size of the screen.
57
-     *
58
-     * NOTE: width is calculated based on the children, but it should also align
59
-     * to {@code FILMSTRIP_SIZE}.
60
-     */
61
-    filmstripWide: {
62
-        ...filmstrip,
63
-        bottom: 0,
64
-        flexDirection: 'column',
65
-        position: 'absolute',
66
-        right: 0,
67
-        top: 0
68
-    },
69
-
70
-    /**
71
-     * Container of the {@link LocalThumbnail}.
72
-     */
73
-    localThumbnail: {
74
-        alignContent: 'stretch',
75
-        alignSelf: 'stretch',
76
-        aspectRatio: 1,
77
-        flexShrink: 0,
78
-        flexDirection: 'row'
79
-    },
80
-
81
-    /**
82
-     * Moderator indicator style.
83
-     */
84
-    moderatorIndicator: {
85
-        backgroundColor: 'transparent',
86
-        bottom: 4,
87
-        color: ColorPalette.white,
88
-        position: 'absolute',
89
-        right: 4
90
-    },
91
-
92
-    /**
93
-     * The style of the scrollview containing the remote thumbnails.
94
-     */
95
-    scrollView: {
96
-        flexGrow: 0
97
-    },
98
-
99
-    /**
100
-     * The style of a participant's Thumbnail which renders either the video or
101
-     * the avatar of the associated participant.
102
-     */
103
-    thumbnail: {
104
-        alignItems: 'stretch',
105
-        backgroundColor: ColorPalette.appBackground,
106
-        borderColor: '#424242',
107
-        borderRadius: 3,
108
-        borderStyle: 'solid',
109
-        borderWidth: 1,
110
-        flex: 1,
111
-        justifyContent: 'center',
112
-        margin: 2,
113
-        overflow: 'hidden',
114
-        position: 'relative'
115
-    },
116
-
117
-    /**
118
-     * The thumbnail audio and video muted indicator style.
119
-     */
120
-    thumbnailIndicator: {
121
-        backgroundColor: 'transparent',
122
-        color: ColorPalette.white,
123
-        paddingLeft: 1,
124
-        paddingRight: 1,
125
-        position: 'relative'
126
-    },
127
-
128
-    /**
129
-     * The thumbnails indicator container.
130
-     */
131
-    thumbnailIndicatorContainer: {
132
-        alignSelf: 'stretch',
133
-        bottom: 4,
134
-        flex: 1,
135
-        flexDirection: 'row',
136
-        left: 4,
137
-        position: 'absolute'
138
-    },
139
-
140
-    tileView: {
141
-        alignSelf: 'center'
142
-    },
143
-
144
-    tileViewRows: {
145
-        justifyContent: 'center'
146
-    },
147
-
148
-    tileViewRow: {
149
-        flexDirection: 'row',
150
-        justifyContent: 'center'
151
-    }
152
-};
153
-
154
-/**
155
- * Color schemed styles for the @{code Thumbnail} component.
156
- */
157
-ColorSchemeRegistry.register('Thumbnail', {
158
-
159
-    /**
160
-     * Tinting style of the on-stage participant thumbnail.
161
-     */
162
-    activeThumbnailTint: {
163
-        backgroundColor: schemeColor('activeParticipantTint')
164
-    },
165
-
166
-    /**
167
-     * Coloring if the thumbnail background.
168
-     */
169
-    participantViewStyle: {
170
-        backgroundColor: schemeColor('background')
171
-    },
172
-
173
-    /**
174
-     * Pinned video thumbnail style.
175
-     */
176
-    thumbnailPinned: {
177
-        borderColor: schemeColor('activeParticipantHighlight'),
178
-        shadowColor: schemeColor('activeParticipantHighlight'),
179
-        shadowOffset: {
180
-            height: 5,
181
-            width: 5
182
-        },
183
-        shadowRadius: 5
184
-    }
185
-});

+ 15
- 4
react/features/filmstrip/components/web/RaisedHandIndicator.js View File

@@ -1,13 +1,20 @@
1 1
 /* @flow */
2 2
 
3
-import React, { Component } from 'react';
3
+import React from 'react';
4
+
5
+import { connect } from '../../../base/redux';
6
+
7
+import AbstractRaisedHandIndicator, {
8
+    type Props as AbstractProps,
9
+    _mapStateToProps
10
+} from '../AbstractRaisedHandIndicator';
4 11
 
5 12
 import BaseIndicator from './BaseIndicator';
6 13
 
7 14
 /**
8 15
  * The type of the React {@code Component} props of {@link RaisedHandIndicator}.
9 16
  */
10
-type Props = {
17
+type Props = AbstractProps & {
11 18
 
12 19
     /**
13 20
      * The font-size for the icon.
@@ -25,13 +32,17 @@ type Props = {
25 32
  *
26 33
  * @extends Component
27 34
  */
28
-class RaisedHandIndicator extends Component<Props> {
35
+class RaisedHandIndicator extends AbstractRaisedHandIndicator<Props> {
29 36
     /**
30 37
      * Implements React's {@link Component#render()}.
31 38
      *
32 39
      * @inheritdoc
33 40
      */
34 41
     render() {
42
+        if (!this.props._raisedHand) {
43
+            return null;
44
+        }
45
+
35 46
         return (
36 47
             <BaseIndicator
37 48
                 className = 'raisehandindicator indicator show-inline'
@@ -43,4 +54,4 @@ class RaisedHandIndicator extends Component<Props> {
43 54
     }
44 55
 }
45 56
 
46
-export default RaisedHandIndicator;
57
+export default connect(_mapStateToProps)(RaisedHandIndicator);

Loading…
Cancel
Save