Ver código fonte

feat(filmstrip): refactor filmstrip only toolbar

- Move the toolbar to the filmstrip feature
- Use all the buttons from the toolbox feature
j8
Saúl Ibarra Corretgé 7 anos atrás
pai
commit
450400b768

+ 14
- 10
react/features/filmstrip/components/Filmstrip.web.js Ver arquivo

5
 import React, { Component } from 'react';
5
 import React, { Component } from 'react';
6
 import { connect } from 'react-redux';
6
 import { connect } from 'react-redux';
7
 
7
 
8
-import { ToolboxFilmstrip, dockToolbox } from '../../toolbox';
8
+import { dockToolbox } from '../../toolbox';
9
 
9
 
10
 import { setFilmstripHovered } from '../actions';
10
 import { setFilmstripHovered } from '../actions';
11
 import { shouldRemoteVideosBeVisible } from '../functions';
11
 import { shouldRemoteVideosBeVisible } from '../functions';
12
 
12
 
13
+import Toolbar from './Toolbar';
14
+
13
 declare var interfaceConfig: Object;
15
 declare var interfaceConfig: Object;
14
 
16
 
15
 /**
17
 /**
33
      * @static
35
      * @static
34
      */
36
      */
35
     static propTypes = {
37
     static propTypes = {
38
+        /**
39
+         * Whether or not the conference is in filmstripOnly mode.
40
+         */
41
+        _filmStripOnly: PropTypes.bool,
42
+
36
         /**
43
         /**
37
          * Whether or not remote videos are currently being hovered over.
44
          * Whether or not remote videos are currently being hovered over.
38
          */
45
          */
53
         /**
60
         /**
54
          * Updates the redux store with filmstrip hover changes.
61
          * Updates the redux store with filmstrip hover changes.
55
          */
62
          */
56
-        dispatch: PropTypes.func,
57
-
58
-        /**
59
-         * Whether or not the conference is in filmstripOnly mode.
60
-         */
61
-        filmstripOnly: PropTypes.bool
63
+        dispatch: PropTypes.func
62
     };
64
     };
63
 
65
 
64
     /**
66
     /**
95
      */
97
      */
96
     render() {
98
     render() {
97
         const {
99
         const {
100
+            _filmStripOnly,
98
             _remoteVideosVisible,
101
             _remoteVideosVisible,
99
-            _toolboxVisible,
100
-            filmstripOnly
102
+            _toolboxVisible
101
         } = this.props;
103
         } = this.props;
102
 
104
 
103
         /**
105
         /**
115
 
117
 
116
         return (
118
         return (
117
             <div className = { filmstripClassNames }>
119
             <div className = { filmstripClassNames }>
118
-                { filmstripOnly && <ToolboxFilmstrip /> }
120
+                { _filmStripOnly && <Toolbar /> }
119
                 <div
121
                 <div
120
                     className = 'filmstrip__videos'
122
                     className = 'filmstrip__videos'
121
                     id = 'remoteVideos'>
123
                     id = 'remoteVideos'>
190
  * @param {Object} state - The Redux state.
192
  * @param {Object} state - The Redux state.
191
  * @private
193
  * @private
192
  * @returns {{
194
  * @returns {{
195
+ *     _filmStripOnly: boolean,
193
  *     _hovered: boolean,
196
  *     _hovered: boolean,
194
  *     _remoteVideosVisible: boolean,
197
  *     _remoteVideosVisible: boolean,
195
  *     _toolboxVisible: boolean
198
  *     _toolboxVisible: boolean
199
     const { hovered } = state['features/filmstrip'];
202
     const { hovered } = state['features/filmstrip'];
200
 
203
 
201
     return {
204
     return {
205
+        _filmStripOnly: Boolean(interfaceConfig.filmStripOnly),
202
         _hovered: hovered,
206
         _hovered: hovered,
203
         _remoteVideosVisible: shouldRemoteVideosBeVisible(state),
207
         _remoteVideosVisible: shouldRemoteVideosBeVisible(state),
204
         _toolboxVisible: state['features/toolbox'].visible
208
         _toolboxVisible: state['features/toolbox'].visible

+ 90
- 0
react/features/filmstrip/components/Toolbar.web.js Ver arquivo

1
+// @flow
2
+
3
+import React, { Component } from 'react';
4
+import { connect } from 'react-redux';
5
+
6
+import {
7
+    AudioMuteButton,
8
+    HangupButton,
9
+    SettingsButton,
10
+    VideoMuteButton
11
+} from '../../toolbox';
12
+
13
+declare var interfaceConfig: Object;
14
+
15
+type Props = {
16
+
17
+    /**
18
+     * Set of buttons which should be visible in this toolbar.
19
+     */
20
+    _visibleButtons: Set<string>
21
+};
22
+
23
+/**
24
+ * Implements the conference toolbar on React/Web for filmstrip only mode.
25
+ *
26
+ * @extends Component
27
+ */
28
+class Toolbar extends Component<Props> {
29
+    /**
30
+     * Implements React's {@link Component#render()}.
31
+     *
32
+     * @inheritdoc
33
+     * @returns {ReactElement}
34
+     */
35
+    render() {
36
+        return (
37
+            <div
38
+                className = 'filmstrip-toolbox'
39
+                id = 'new-toolbox'>
40
+                <AudioMuteButton
41
+                    tooltipPosition = 'left'
42
+                    visible = { this._shouldShowButton('microphone') } />
43
+                <HangupButton
44
+                    tooltipPosition = 'left'
45
+                    visible = { this._shouldShowButton('hangup') } />
46
+                <VideoMuteButton
47
+                    tooltipPosition = 'left'
48
+                    visible = { this._shouldShowButton('camera') } />
49
+                <SettingsButton
50
+                    tooltipPosition = 'left'
51
+                    visible = { this._shouldShowButton('fodeviceselection') } />
52
+            </div>
53
+        );
54
+    }
55
+
56
+    _shouldShowButton: (string) => boolean;
57
+
58
+    /**
59
+     * Returns if a button name has been explicitly configured to be displayed.
60
+     *
61
+     * @param {string} buttonName - The name of the button, as expected in
62
+     * {@link intefaceConfig}.
63
+     * @private
64
+     * @returns {boolean} True if the button should be displayed, false
65
+     * otherwise.
66
+     */
67
+    _shouldShowButton(buttonName) {
68
+        return this.props._visibleButtons.has(buttonName);
69
+    }
70
+}
71
+
72
+/**
73
+ * Maps (parts of) the redux state to the associated props for this component.
74
+ *
75
+ * @param {Object} state - The Redux state.
76
+ * @private
77
+ * @returns {{
78
+ *     _visibleButtons: Set<string>
79
+ * }}
80
+ */
81
+function _mapStateToProps(state): Object { // eslint-disable-line no-unused-vars
82
+    // XXX: We are not currently using state here, but in the future, when
83
+    // interfaceConfig is part of redux we will.
84
+
85
+    return {
86
+        _visibleButtons: new Set(interfaceConfig.TOOLBAR_BUTTONS)
87
+    };
88
+}
89
+
90
+export default connect(_mapStateToProps)(Toolbar);

+ 0
- 0
react/features/toolbox/components/ToolboxFilmstrip.native.js Ver arquivo


+ 0
- 98
react/features/toolbox/components/ToolboxFilmstrip.web.js Ver arquivo

1
-// @flow
2
-
3
-import React, { Component } from 'react';
4
-import { connect } from 'react-redux';
5
-
6
-import { createToolbarEvent, sendAnalytics } from '../../analytics';
7
-import { translate } from '../../base/i18n';
8
-import { openDeviceSelectionDialog } from '../../device-selection';
9
-
10
-import ToolbarButton from './ToolbarButton';
11
-import { AudioMuteButton, HangupButton, VideoMuteButton } from './buttons';
12
-
13
-declare var interfaceConfig: Object;
14
-
15
-/**
16
- * Implements the conference toolbox on React/Web for filmstrip only mode.
17
- *
18
- * @extends Component
19
- */
20
-class ToolboxFilmstrip extends Component<*> {
21
-    _visibleButtons: Object;
22
-
23
-    /**
24
-     * Initializes a new {@code ToolboxFilmstrip} instance.
25
-     *
26
-     * @param {Props} props - The read-only React {@code Component} props with
27
-     * which the new instance is to be initialized.
28
-     */
29
-    constructor(props) {
30
-        super(props);
31
-
32
-        this._visibleButtons = new Set(interfaceConfig.TOOLBAR_BUTTONS);
33
-
34
-        // Bind event handlers so they are only bound once per instance.
35
-        this._onToolbarOpenSettings = this._onToolbarOpenSettings.bind(this);
36
-    }
37
-
38
-    /**
39
-     * Implements React's {@link Component#render()}.
40
-     *
41
-     * @inheritdoc
42
-     * @returns {ReactElement}
43
-     */
44
-    render() {
45
-        const { t } = this.props;
46
-
47
-        return (
48
-            <div
49
-                className = 'filmstrip-toolbox'
50
-                id = 'new-toolbox'>
51
-                { this._shouldShowButton('microphone')
52
-                    && <AudioMuteButton tooltipPosition = 'left' /> }
53
-                { this._shouldShowButton('camera')
54
-                    && <VideoMuteButton tooltipPosition = 'left' /> }
55
-                { this._shouldShowButton('fodeviceselection')
56
-                    && <ToolbarButton
57
-                        accessibilityLabel = 'Settings'
58
-                        iconName = 'icon-settings'
59
-                        onClick = { this._onToolbarOpenSettings }
60
-                        tooltip = { t('toolbar.Settings') }
61
-                        tooltipPosition = 'left' /> }
62
-                { this._shouldShowButton('hangup')
63
-                    && <HangupButton tooltipPosition = 'left' /> }
64
-            </div>
65
-        );
66
-    }
67
-
68
-    _onToolbarOpenSettings: () => void;
69
-
70
-    /**
71
-     * Creates an analytics toolbar event for and dispatches an action to open
72
-     * the device selection popup dialog.
73
-     *
74
-     * @private
75
-     * @returns {void}
76
-     */
77
-    _onToolbarOpenSettings() {
78
-        sendAnalytics(createToolbarEvent('filmstrip.only.device.selection'));
79
-
80
-        this.props.dispatch(openDeviceSelectionDialog());
81
-    }
82
-
83
-    _shouldShowButton: (string) => boolean;
84
-
85
-    /**
86
-     * Returns if a button name has been explicitly configured to be displayed.
87
-     *
88
-     * @param {string} buttonName - The name of the button, as expected in
89
-     * {@link intefaceConfig}.
90
-     * @private
91
-     * @returns {boolean} True if the button should be displayed.
92
-     */
93
-    _shouldShowButton(buttonName) {
94
-        return this._visibleButtons.has(buttonName);
95
-    }
96
-}
97
-
98
-export default translate(connect()(ToolboxFilmstrip));

+ 0
- 1
react/features/toolbox/components/index.js Ver arquivo

1
 export { default as ToolbarButton } from './ToolbarButton';
1
 export { default as ToolbarButton } from './ToolbarButton';
2
-export { default as ToolboxFilmstrip } from './ToolboxFilmstrip';
3
 export { default as Toolbox } from './Toolbox';
2
 export { default as Toolbox } from './Toolbox';
4
 export * from './buttons';
3
 export * from './buttons';

Carregando…
Cancelar
Salvar