Bladeren bron

Extract isToolboxVisible function

efficient_tiling
Bettenbuk Zoltan 6 jaren geleden
bovenliggende
commit
045a2d6aca

+ 5
- 4
react/features/toolbox/components/native/Toolbox.js Bestand weergeven

@@ -7,8 +7,12 @@ import { connect } from 'react-redux';
7 7
 import { Container } from '../../../base/react';
8 8
 import { ChatButton } from '../../../chat';
9 9
 
10
+import { isToolboxVisible } from '../../functions';
11
+
10 12
 import AudioMuteButton from '../AudioMuteButton';
11 13
 import HangupButton from '../HangupButton';
14
+import VideoMuteButton from '../VideoMuteButton';
15
+
12 16
 import OverflowMenuButton from './OverflowMenuButton';
13 17
 import styles, {
14 18
     chatButtonOverride,
@@ -16,7 +20,6 @@ import styles, {
16 20
     toolbarButtonStyles,
17 21
     toolbarToggledButtonStyles
18 22
 } from './styles';
19
-import VideoMuteButton from '../VideoMuteButton';
20 23
 
21 24
 /**
22 25
  * The number of buttons other than {@link HangupButton} to render in
@@ -262,10 +265,8 @@ class Toolbox extends Component<Props, State> {
262 265
  * }}
263 266
  */
264 267
 function _mapStateToProps(state: Object): Object {
265
-    const { alwaysVisible, enabled, visible } = state['features/toolbox'];
266
-
267 268
     return {
268
-        _visible: enabled && (alwaysVisible || visible)
269
+        _visible: isToolboxVisible(state)
269 270
     };
270 271
 }
271 272
 

+ 17
- 0
react/features/toolbox/functions.any.js Bestand weergeven

@@ -0,0 +1,17 @@
1
+// @flow
2
+
3
+import { toState } from '../base/redux';
4
+
5
+/**
6
+ * Returns true if the toolbox is visible.
7
+ *
8
+ * @param {Object | Function} stateful - A function or object that can be
9
+ * resolved to Redux state by the function {@code toState}.
10
+ * @returns {boolean}
11
+ */
12
+export function isToolboxVisible(stateful: Object | Function) {
13
+    const { alwaysVisible, enabled, visible }
14
+        = toState(stateful)['features/toolbox'];
15
+
16
+    return enabled && (alwaysVisible || visible);
17
+}

+ 3
- 0
react/features/toolbox/functions.native.js Bestand weergeven

@@ -0,0 +1,3 @@
1
+// @flow
2
+
3
+export * from './functions.any';

+ 2
- 0
react/features/toolbox/functions.web.js Bestand weergeven

@@ -1,5 +1,7 @@
1 1
 // @flow
2 2
 
3
+export * from './functions.any';
4
+
3 5
 declare var interfaceConfig: Object;
4 6
 
5 7
 /**

Laden…
Annuleren
Opslaan