Pārlūkot izejas kodu

Generalize indicators

master
Bettenbuk Zoltan 6 gadus atpakaļ
vecāks
revīzija
4e78502c9e

+ 21
- 1
react/features/filmstrip/components/AbstractRaisedHandIndicator.js Parādīt failu

15
     /**
15
     /**
16
      * True if the hand is raised for this participant.
16
      * True if the hand is raised for this participant.
17
      */
17
      */
18
-    _raisedHand: boolean
18
+    _raisedHand?: boolean
19
 }
19
 }
20
 
20
 
21
 /**
21
 /**
24
 export default class AbstractRaisedHandIndicator<P: Props>
24
 export default class AbstractRaisedHandIndicator<P: Props>
25
     extends Component<P> {
25
     extends Component<P> {
26
 
26
 
27
+    /**
28
+     * Implements {@code Component#render}.
29
+     *
30
+     * @inheritdoc
31
+     */
32
+    render() {
33
+        if (!this.props._raisedHand) {
34
+            return null;
35
+        }
36
+
37
+        return this._renderIndicator();
38
+    }
39
+
40
+    /**
41
+     * Renders the platform specific indicator element.
42
+     *
43
+     * @returns {React$Element<*>}
44
+     */
45
+    _renderIndicator: () => React$Element<*>
46
+
27
 }
47
 }
28
 
48
 
29
 /**
49
 /**

+ 7
- 7
react/features/filmstrip/components/native/AudioMutedIndicator.js Parādīt failu

1
-import React, { Component } from 'react';
1
+// @flow
2
 
2
 
3
-import { Icon } from '../../../base/font-icons';
3
+import React, { Component } from 'react';
4
 
4
 
5
-import styles from './styles';
5
+import BaseIndicator from './BaseIndicator';
6
 
6
 
7
 /**
7
 /**
8
  * Thumbnail badge for displaying the audio mute status of a participant.
8
  * Thumbnail badge for displaying the audio mute status of a participant.
9
  */
9
  */
10
-export default class AudioMutedIndicator extends Component {
10
+export default class AudioMutedIndicator extends Component<{}> {
11
     /**
11
     /**
12
      * Implements React's {@link Component#render()}.
12
      * Implements React's {@link Component#render()}.
13
      *
13
      *
15
      */
15
      */
16
     render() {
16
     render() {
17
         return (
17
         return (
18
-            <Icon
19
-                name = 'mic-disabled'
20
-                style = { styles.thumbnailIndicator } />
18
+            <BaseIndicator
19
+                highlight = { false }
20
+                icon = 'mic-disabled' />
21
         );
21
         );
22
     }
22
     }
23
 }
23
 }

+ 51
- 0
react/features/filmstrip/components/native/BaseIndicator.js Parādīt failu

1
+// @flow
2
+
3
+import React, { Component } from 'react';
4
+import { View } from 'react-native';
5
+
6
+import { Icon } from '../../../base/font-icons';
7
+
8
+import styles from './styles';
9
+
10
+type Props = {
11
+
12
+    /**
13
+     * True if a highlighted background has to be applied.
14
+     */
15
+    highlight: boolean,
16
+
17
+    /**
18
+     * The name of the icon to be used as the indicator.
19
+     */
20
+    icon: string
21
+};
22
+
23
+/**
24
+ * Implements a base indicator to be reused across all native indicators on
25
+ * the filmstrip.
26
+ */
27
+export default class BaseIndicator extends Component<Props> {
28
+    /**
29
+     * Implements React's {@link Component#render()}.
30
+     *
31
+     * @inheritdoc
32
+     */
33
+    render() {
34
+        const { highlight, icon } = this.props;
35
+
36
+        const iconElement = (<Icon
37
+            name = { icon }
38
+            style = { styles.indicator } />
39
+        );
40
+
41
+        if (highlight) {
42
+            return (
43
+                <View style = { styles.indicatorBackground }>
44
+                    { iconElement }
45
+                </View>
46
+            );
47
+        }
48
+
49
+        return iconElement;
50
+    }
51
+}

+ 5
- 10
react/features/filmstrip/components/native/DominantSpeakerIndicator.js Parādīt failu

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

+ 7
- 7
react/features/filmstrip/components/native/ModeratorIndicator.js Parādīt failu

1
-import React, { Component } from 'react';
1
+// @flow
2
 
2
 
3
-import { Icon } from '../../../base/font-icons';
3
+import React, { Component } from 'react';
4
 
4
 
5
-import styles from './styles';
5
+import BaseIndicator from './BaseIndicator';
6
 
6
 
7
 /**
7
 /**
8
  * Thumbnail badge showing that the participant is a conference moderator.
8
  * Thumbnail badge showing that the participant is a conference moderator.
9
  */
9
  */
10
-export default class ModeratorIndicator extends Component {
10
+export default class ModeratorIndicator extends Component<{}> {
11
     /**
11
     /**
12
      * Implements React's {@link Component#render()}.
12
      * Implements React's {@link Component#render()}.
13
      *
13
      *
15
      */
15
      */
16
     render() {
16
     render() {
17
         return (
17
         return (
18
-            <Icon
19
-                name = 'star'
20
-                style = { styles.moderatorIndicator } />
18
+            <BaseIndicator
19
+                highlight = { false }
20
+                icon = 'star' />
21
         );
21
         );
22
     }
22
     }
23
 }
23
 }

+ 8
- 16
react/features/filmstrip/components/native/RaisedHandIndicator.js Parādīt failu

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

+ 10
- 6
react/features/filmstrip/components/native/Thumbnail.js Parādīt failu

1
 // @flow
1
 // @flow
2
 
2
 
3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
+import { View } from 'react-native';
4
 import type { Dispatch } from 'redux';
5
 import type { Dispatch } from 'redux';
5
 
6
 
6
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
7
 import { ColorSchemeRegistry } from '../../../base/color-scheme';
163
                     zOrder = { 1 } />
164
                     zOrder = { 1 } />
164
 
165
 
165
                 { participant.role === PARTICIPANT_ROLE.MODERATOR
166
                 { participant.role === PARTICIPANT_ROLE.MODERATOR
166
-                    && <ModeratorIndicator /> }
167
-
168
-                { participant.dominantSpeaker
169
-                    && <DominantSpeakerIndicator /> }
170
-
171
-                <RaisedHandIndicator participantId = { participant.id } />
167
+                    && <View style = { styles.moderatorIndicatorContainer }>
168
+                        <ModeratorIndicator />
169
+                    </View> }
170
+
171
+                <View style = { styles.thumbnailTopIndicatorContainer }>
172
+                    <RaisedHandIndicator participantId = { participant.id } />
173
+                    { participant.dominantSpeaker
174
+                        && <DominantSpeakerIndicator /> }
175
+                </View>
172
 
176
 
173
                 <Container style = { styles.thumbnailIndicatorContainer }>
177
                 <Container style = { styles.thumbnailIndicatorContainer }>
174
                     { audioMuted
178
                     { audioMuted

+ 7
- 7
react/features/filmstrip/components/native/VideoMutedIndicator.js Parādīt failu

1
-import React, { Component } from 'react';
1
+// @flow
2
 
2
 
3
-import { Icon } from '../../../base/font-icons';
3
+import React, { Component } from 'react';
4
 
4
 
5
-import styles from './styles';
5
+import BaseIndicator from './BaseIndicator';
6
 
6
 
7
 /**
7
 /**
8
  * Thumbnail badge for displaying the video mute status of a participant.
8
  * Thumbnail badge for displaying the video mute status of a participant.
9
  */
9
  */
10
-export default class VideoMutedIndicator extends Component {
10
+export default class VideoMutedIndicator extends Component<{}> {
11
     /**
11
     /**
12
      * Implements React's {@link Component#render()}.
12
      * Implements React's {@link Component#render()}.
13
      *
13
      *
15
      */
15
      */
16
     render() {
16
     render() {
17
         return (
17
         return (
18
-            <Icon
19
-                name = 'camera-disabled'
20
-                style = { styles.thumbnailIndicator } />
18
+            <BaseIndicator
19
+                highlight = { false }
20
+                icon = 'camera-disabled' />
21
         );
21
         );
22
     }
22
     }
23
 }
23
 }

+ 21
- 37
react/features/filmstrip/components/native/styles.js Parādīt failu

10
  */
10
  */
11
 export const AVATAR_SIZE = 50;
11
 export const AVATAR_SIZE = 50;
12
 
12
 
13
-/**
14
- * The base/default style of indicators such as audioMutedIndicator,
15
- * moderatorIndicator, and videoMutedIndicator.
16
- */
17
-const indicator = {
18
-    textShadowColor: ColorPalette.black,
19
-    textShadowOffset: {
20
-        height: -1,
21
-        width: 0
22
-    }
23
-};
24
-
25
 /**
13
 /**
26
  * The styles of the feature filmstrip.
14
  * The styles of the feature filmstrip.
27
  */
15
  */
30
      * Dominant speaker indicator style.
18
      * Dominant speaker indicator style.
31
      */
19
      */
32
     indicator: {
20
     indicator: {
21
+        backgroundColor: ColorPalette.transparent,
33
         color: ColorPalette.white,
22
         color: ColorPalette.white,
34
-        fontSize: 12
23
+        fontSize: 12,
24
+        textShadowColor: ColorPalette.black,
25
+        textShadowOffset: {
26
+            height: -1,
27
+            width: 0
28
+        }
35
     },
29
     },
36
 
30
 
37
     /**
31
     /**
38
      * Dominant speaker indicator background style.
32
      * Dominant speaker indicator background style.
39
      */
33
      */
40
     indicatorBackground: {
34
     indicatorBackground: {
35
+        alignItems: 'center',
41
         backgroundColor: ColorPalette.blue,
36
         backgroundColor: ColorPalette.blue,
42
         borderRadius: 16,
37
         borderRadius: 16,
43
-        left: 4,
44
-        padding: 4,
45
-        position: 'absolute',
46
-        top: 4
38
+        flexDirection: 'row',
39
+        justifyContent: 'center',
40
+        height: 20,
41
+        width: 20
47
     },
42
     },
48
 
43
 
49
     /**
44
     /**
84
         flexDirection: 'row'
79
         flexDirection: 'row'
85
     },
80
     },
86
 
81
 
87
-    /**
88
-     * Moderator indicator style.
89
-     */
90
-    moderatorIndicator: {
91
-        backgroundColor: 'transparent',
82
+    moderatorIndicatorContainer: {
92
         bottom: 4,
83
         bottom: 4,
93
-        color: ColorPalette.white,
94
         position: 'absolute',
84
         position: 'absolute',
95
-        right: 4,
96
-        ...indicator
85
+        right: 4
97
     },
86
     },
98
 
87
 
99
     /**
88
     /**
123
         width: 80
112
         width: 80
124
     },
113
     },
125
 
114
 
126
-    /**
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
     /**
115
     /**
139
      * The thumbnails indicator container.
116
      * The thumbnails indicator container.
140
      */
117
      */
147
         position: 'absolute'
124
         position: 'absolute'
148
     },
125
     },
149
 
126
 
127
+    thumbnailTopIndicatorContainer: {
128
+        left: 0,
129
+        padding: 4,
130
+        position: 'absolute',
131
+        top: 0
132
+    },
133
+
150
     tileView: {
134
     tileView: {
151
         alignSelf: 'center'
135
         alignSelf: 'center'
152
     },
136
     },

+ 3
- 7
react/features/filmstrip/components/web/RaisedHandIndicator.js Parādīt failu

34
  */
34
  */
35
 class RaisedHandIndicator extends AbstractRaisedHandIndicator<Props> {
35
 class RaisedHandIndicator extends AbstractRaisedHandIndicator<Props> {
36
     /**
36
     /**
37
-     * Implements React's {@link Component#render()}.
37
+     * Renders the platform specific indicator element.
38
      *
38
      *
39
-     * @inheritdoc
39
+     * @returns {React$Element<*>}
40
      */
40
      */
41
-    render() {
42
-        if (!this.props._raisedHand) {
43
-            return null;
44
-        }
45
-
41
+    _renderIndicator() {
46
         return (
42
         return (
47
             <BaseIndicator
43
             <BaseIndicator
48
                 className = 'raisehandindicator indicator show-inline'
44
                 className = 'raisehandindicator indicator show-inline'

Notiek ielāde…
Atcelt
Saglabāt