|
@@ -1,7 +1,6 @@
|
1
|
1
|
/* @flow */
|
2
|
2
|
|
3
|
3
|
import _ from 'lodash';
|
4
|
|
-import PropTypes from 'prop-types';
|
5
|
4
|
import React, { Component } from 'react';
|
6
|
5
|
import { connect } from 'react-redux';
|
7
|
6
|
|
|
@@ -13,13 +12,40 @@ import Toolbar from './Toolbar';
|
13
|
12
|
|
14
|
13
|
declare var interfaceConfig: Object;
|
15
|
14
|
|
|
15
|
+/**
|
|
16
|
+ * The type of the React {@code Component} props of {@link Filmstrip}.
|
|
17
|
+ */
|
|
18
|
+type Props = {
|
|
19
|
+
|
|
20
|
+ /**
|
|
21
|
+ * Additional CSS class names top add to the root.
|
|
22
|
+ */
|
|
23
|
+ _className: string,
|
|
24
|
+
|
|
25
|
+ /**
|
|
26
|
+ * Whether the UI/UX is filmstrip-only.
|
|
27
|
+ */
|
|
28
|
+ _filmstripOnly: boolean,
|
|
29
|
+
|
|
30
|
+ /**
|
|
31
|
+ * Whether or not remote videos are currently being hovered over. Hover
|
|
32
|
+ * handling is currently being handled detected outside of react.
|
|
33
|
+ */
|
|
34
|
+ _hovered: boolean,
|
|
35
|
+
|
|
36
|
+ /**
|
|
37
|
+ * The redux {@code dispatch} function.
|
|
38
|
+ */
|
|
39
|
+ dispatch: Dispatch<*>
|
|
40
|
+};
|
|
41
|
+
|
16
|
42
|
/**
|
17
|
43
|
* Implements a React {@link Component} which represents the filmstrip on
|
18
|
44
|
* Web/React.
|
19
|
45
|
*
|
20
|
46
|
* @extends Component
|
21
|
47
|
*/
|
22
|
|
-class Filmstrip extends Component<*> {
|
|
48
|
+class Filmstrip extends Component <Props> {
|
23
|
49
|
_isHovered: boolean;
|
24
|
50
|
|
25
|
51
|
_notifyOfHoveredStateUpdate: Function;
|
|
@@ -28,47 +54,13 @@ class Filmstrip extends Component<*> {
|
28
|
54
|
|
29
|
55
|
_onMouseOver: Function;
|
30
|
56
|
|
31
|
|
- /**
|
32
|
|
- * {@code Filmstrip} component's property types.
|
33
|
|
- *
|
34
|
|
- * @static
|
35
|
|
- */
|
36
|
|
- static propTypes = {
|
37
|
|
- /**
|
38
|
|
- * Whether the UI/UX is filmstrip-only.
|
39
|
|
- */
|
40
|
|
- _filmstripOnly: PropTypes.bool,
|
41
|
|
-
|
42
|
|
- /**
|
43
|
|
- * Whether or not remote videos are currently being hovered over.
|
44
|
|
- */
|
45
|
|
- _hovered: PropTypes.bool,
|
46
|
|
-
|
47
|
|
- /**
|
48
|
|
- * Whether or not the remote videos should be visible. Will toggle
|
49
|
|
- * a class for hiding the videos.
|
50
|
|
- */
|
51
|
|
- _remoteVideosVisible: PropTypes.bool,
|
52
|
|
-
|
53
|
|
- /**
|
54
|
|
- * Whether or not the toolbox is visible. The height of the vertical
|
55
|
|
- * filmstrip needs to adjust to accommodate the horizontal toolbox.
|
56
|
|
- */
|
57
|
|
- _toolboxVisible: PropTypes.bool,
|
58
|
|
-
|
59
|
|
- /**
|
60
|
|
- * The redux {@code dispatch} function.
|
61
|
|
- */
|
62
|
|
- dispatch: PropTypes.func
|
63
|
|
- };
|
64
|
|
-
|
65
|
57
|
/**
|
66
|
58
|
* Initializes a new {@code Filmstrip} instance.
|
67
|
59
|
*
|
68
|
60
|
* @param {Object} props - The read-only properties with which the new
|
69
|
61
|
* instance is to be initialized.
|
70
|
62
|
*/
|
71
|
|
- constructor(props) {
|
|
63
|
+ constructor(props: Props) {
|
72
|
64
|
super(props);
|
73
|
65
|
|
74
|
66
|
// Debounce the method for dispatching the new filmstrip handled state
|
|
@@ -95,30 +87,16 @@ class Filmstrip extends Component<*> {
|
95
|
87
|
* @returns {ReactElement}
|
96
|
88
|
*/
|
97
|
89
|
render() {
|
98
|
|
- const {
|
99
|
|
- _filmstripOnly,
|
100
|
|
- _remoteVideosVisible,
|
101
|
|
- _toolboxVisible
|
102
|
|
- } = this.props;
|
103
|
|
-
|
104
|
90
|
// Note: Appending of {@code RemoteVideo} views is handled through
|
105
|
91
|
// VideoLayout. The views do not get blown away on render() because
|
106
|
92
|
// ReactDOMComponent is only aware of the given JSX and not new appended
|
107
|
93
|
// DOM. As such, when updateDOMProperties gets called, only attributes
|
108
|
94
|
// will get updated without replacing the DOM. If the known DOM gets
|
109
|
95
|
// modified, then the views will get blown away.
|
110
|
|
- const reduceHeight
|
111
|
|
- = !_filmstripOnly
|
112
|
|
- && _toolboxVisible
|
113
|
|
- && interfaceConfig.TOOLBAR_BUTTONS.length;
|
114
|
|
- const classNames
|
115
|
|
- = `filmstrip ${
|
116
|
|
- _remoteVideosVisible ? '' : 'hide-videos'} ${
|
117
|
|
- reduceHeight ? 'reduce-height' : ''}`;
|
118
|
96
|
|
119
|
97
|
return (
|
120
|
|
- <div className = { classNames }>
|
121
|
|
- { _filmstripOnly && <Toolbar /> }
|
|
98
|
+ <div className = { `filmstrip ${this.props._className}` }>
|
|
99
|
+ { this.props._filmstripOnly && <Toolbar /> }
|
122
|
100
|
<div
|
123
|
101
|
className = 'filmstrip__videos'
|
124
|
102
|
id = 'remoteVideos'>
|
|
@@ -193,20 +171,26 @@ class Filmstrip extends Component<*> {
|
193
|
171
|
* @param {Object} state - The Redux state.
|
194
|
172
|
* @private
|
195
|
173
|
* @returns {{
|
196
|
|
- * _filmstripOnly: boolean,
|
|
174
|
+ * _className: string,
|
197
|
175
|
* _hovered: boolean,
|
198
|
|
- * _remoteVideosVisible: boolean,
|
199
|
|
- * _toolboxVisible: boolean
|
|
176
|
+ * _filmstripOnly: boolean
|
200
|
177
|
* }}
|
201
|
178
|
*/
|
202
|
179
|
function _mapStateToProps(state) {
|
203
|
180
|
const { hovered } = state['features/filmstrip'];
|
|
181
|
+ const isFilmstripOnly = Boolean(interfaceConfig.filmStripOnly);
|
|
182
|
+ const reduceHeight = !isFilmstripOnly
|
|
183
|
+ && state['features/toolbox'].visible
|
|
184
|
+ && interfaceConfig.TOOLBAR_BUTTONS.length;
|
|
185
|
+ const remoteVideosVisible = shouldRemoteVideosBeVisible(state);
|
|
186
|
+
|
|
187
|
+ const className = `${remoteVideosVisible ? '' : 'hide-videos'} ${
|
|
188
|
+ reduceHeight ? 'reduce-height' : ''}`;
|
204
|
189
|
|
205
|
190
|
return {
|
206
|
|
- _filmstripOnly: Boolean(interfaceConfig.filmStripOnly),
|
207
|
|
- _hovered: hovered,
|
208
|
|
- _remoteVideosVisible: shouldRemoteVideosBeVisible(state),
|
209
|
|
- _toolboxVisible: state['features/toolbox'].visible
|
|
191
|
+ _className: className,
|
|
192
|
+ _filmstripOnly: isFilmstripOnly,
|
|
193
|
+ _hovered: hovered
|
210
|
194
|
};
|
211
|
195
|
}
|
212
|
196
|
|