|
@@ -1,103 +0,0 @@
|
1
|
|
-import React, { Component } from 'react';
|
2
|
|
-import { connect } from 'react-redux';
|
3
|
|
-
|
4
|
|
-import { toggleAudioOnly } from '../../base/conference';
|
5
|
|
-
|
6
|
|
-import ToolbarButton from './ToolbarButton';
|
7
|
|
-
|
8
|
|
-/**
|
9
|
|
- * React {@code Component} for toggling audio only mode.
|
10
|
|
- *
|
11
|
|
- * @extends Component
|
12
|
|
- */
|
13
|
|
-class AudioOnlyButton extends Component {
|
14
|
|
- /**
|
15
|
|
- * {@code AudioOnlyButton}'s property types.
|
16
|
|
- *
|
17
|
|
- * @static
|
18
|
|
- */
|
19
|
|
- static propTypes = {
|
20
|
|
- /**
|
21
|
|
- * Whether or not audio only mode is enabled.
|
22
|
|
- */
|
23
|
|
- _audioOnly: React.PropTypes.bool,
|
24
|
|
-
|
25
|
|
- /**
|
26
|
|
- * Invoked to toggle audio only mode.
|
27
|
|
- */
|
28
|
|
- dispatch: React.PropTypes.func,
|
29
|
|
-
|
30
|
|
- /**
|
31
|
|
- * From which side the button tooltip should appear.
|
32
|
|
- */
|
33
|
|
- tooltipPosition: React.PropTypes.string
|
34
|
|
- }
|
35
|
|
-
|
36
|
|
- /**
|
37
|
|
- * Initializes a new {@code AudioOnlyButton} instance.
|
38
|
|
- *
|
39
|
|
- * @param {Object} props - The read-only properties with which the new
|
40
|
|
- * instance is to be initialized.
|
41
|
|
- */
|
42
|
|
- constructor(props) {
|
43
|
|
- super(props);
|
44
|
|
-
|
45
|
|
- // Bind event handlers so they are only bound once for every instance.
|
46
|
|
- this._onClick = this._onClick.bind(this);
|
47
|
|
- }
|
48
|
|
-
|
49
|
|
- /**
|
50
|
|
- * Implements React's {@link Component#render()}.
|
51
|
|
- *
|
52
|
|
- * @inheritdoc
|
53
|
|
- * @returns {ReactElement}
|
54
|
|
- */
|
55
|
|
- render() {
|
56
|
|
- const buttonConfiguration = {
|
57
|
|
- buttonName: 'audioonly',
|
58
|
|
- classNames: [ 'button', 'icon-visibility' ],
|
59
|
|
- enabled: true,
|
60
|
|
- id: 'toolbar_button_audioonly',
|
61
|
|
- tooltipKey: 'toolbar.audioonly'
|
62
|
|
- };
|
63
|
|
-
|
64
|
|
- if (this.props._audioOnly) {
|
65
|
|
- buttonConfiguration.classNames.push('toggled button-active');
|
66
|
|
- }
|
67
|
|
-
|
68
|
|
- return (
|
69
|
|
- <ToolbarButton
|
70
|
|
- button = { buttonConfiguration }
|
71
|
|
- onClick = { this._onClick }
|
72
|
|
- tooltipPosition = { this.props.tooltipPosition } />
|
73
|
|
- );
|
74
|
|
- }
|
75
|
|
-
|
76
|
|
- /**
|
77
|
|
- * Dispatches an action to toggle audio only mode.
|
78
|
|
- *
|
79
|
|
- * @private
|
80
|
|
- * @returns {void}
|
81
|
|
- */
|
82
|
|
- _onClick() {
|
83
|
|
- this.props.dispatch(toggleAudioOnly());
|
84
|
|
- }
|
85
|
|
-}
|
86
|
|
-
|
87
|
|
-/**
|
88
|
|
- * Maps (parts of) the Redux state to the associated {@code AudioOnlyButton}'s
|
89
|
|
- * props.
|
90
|
|
- *
|
91
|
|
- * @param {Object} state - The Redux state.
|
92
|
|
- * @private
|
93
|
|
- * @returns {{
|
94
|
|
- * _audioOnly: boolean
|
95
|
|
- * }}
|
96
|
|
- */
|
97
|
|
-function _mapStateToProps(state) {
|
98
|
|
- return {
|
99
|
|
- _audioOnly: state['features/base/conference'].audioOnly
|
100
|
|
- };
|
101
|
|
-}
|
102
|
|
-
|
103
|
|
-export default connect(_mapStateToProps)(AudioOnlyButton);
|