瀏覽代碼

ref(toolbox): getter for the recording/streaming disabled tooltip

master
Leonard Kim 7 年之前
父節點
當前提交
007d60eb6c

+ 11
- 1
react/features/base/toolbox/components/AbstractButton.js 查看文件

@@ -206,6 +206,16 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
206 206
         return buttonStyles;
207 207
     }
208 208
 
209
+    /**
210
+     * Get the tooltip to display when hovering over the button.
211
+     *
212
+     * @private
213
+     * @returns {string}
214
+     */
215
+    _getTooltip() {
216
+        return this.tooltip || '';
217
+    }
218
+
209 219
     /**
210 220
      * Helper function to be implemented by subclasses, which must return a
211 221
      * boolean value indicating if this button is disabled or not.
@@ -258,7 +268,7 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
258 268
             iconName: this._getIconName(),
259 269
             label: this._getLabel(),
260 270
             styles: this._getStyles(),
261
-            tooltip: this.tooltip
271
+            tooltip: this._getTooltip()
262 272
         };
263 273
 
264 274
         return (

+ 10
- 20
react/features/recording/components/LiveStream/web/LiveStreamButton.js 查看文件

@@ -37,26 +37,6 @@ class LiveStreamButton extends AbstractLiveStreamButton<Props> {
37 37
     iconName = 'icon-public';
38 38
     toggledIconName = 'icon-public';
39 39
 
40
-    /**
41
-     * Constructor of the component.
42
-     *
43
-     * @inheritdoc
44
-     */
45
-    constructor(props: Props) {
46
-        super(props);
47
-
48
-        this.tooltip = props._liveStreamDisabledTooltipKey;
49
-    }
50
-
51
-    /**
52
-     * Implements {@code Component}'s componentWillReceiveProps.
53
-     *
54
-     * @inheritdoc
55
-     */
56
-    componentWillReceiveProps(newProps: Props) {
57
-        this.tooltip = newProps._liveStreamDisabledTooltipKey;
58
-    }
59
-
60 40
     /**
61 41
      * Helper function to be implemented by subclasses, which returns
62 42
      * a React Element to display (a beta tag) at the end of the button.
@@ -76,6 +56,16 @@ class LiveStreamButton extends AbstractLiveStreamButton<Props> {
76 56
         );
77 57
     }
78 58
 
59
+    /**
60
+     * Returns the tooltip that should be displayed when the button is disabled.
61
+     *
62
+     * @private
63
+     * @returns {string}
64
+     */
65
+    _getTooltip() {
66
+        return this.props._liveStreamDisabledTooltipKey || '';
67
+    }
68
+
79 69
     /**
80 70
      * Helper function to be implemented by subclasses, which must return a
81 71
      * boolean value indicating if this button is disabled or not.

+ 5
- 15
react/features/recording/components/Recording/web/RecordButton.js 查看文件

@@ -36,23 +36,13 @@ class RecordButton extends AbstractRecordButton<Props> {
36 36
     toggledIconName = 'icon-camera-take-picture';
37 37
 
38 38
     /**
39
-     * Constructor of the component.
39
+     * Returns the tooltip that should be displayed when the button is disabled.
40 40
      *
41
-     * @inheritdoc
41
+     * @private
42
+     * @returns {string}
42 43
      */
43
-    constructor(props: Props) {
44
-        super(props);
45
-
46
-        this.tooltip = props._fileRecordingsDisabledTooltipKey;
47
-    }
48
-
49
-    /**
50
-     * Implements {@code Component}'s componentWillReceiveProps.
51
-     *
52
-     * @inheritdoc
53
-     */
54
-    componentWillReceiveProps(newProps: Props) {
55
-        this.tooltip = newProps._fileRecordingsDisabledTooltipKey;
44
+    _getTooltip() {
45
+        return this.tooltip || '';
56 46
     }
57 47
 
58 48
     /**

Loading…
取消
儲存