瀏覽代碼

fix(blur): add beta label to toolbar button

j8
Leonard Kim 5 年之前
父節點
當前提交
011972872e

+ 36
- 0
react/features/base/toolbox/components/BetaTag.js 查看文件

@@ -0,0 +1,36 @@
1
+// @flow
2
+
3
+import React, { Component } from 'react';
4
+
5
+import { translate } from '../../i18n';
6
+import { Container, Text } from '../../react';
7
+
8
+type Props = {
9
+    t: Function
10
+};
11
+
12
+/**
13
+ * Creates a ReactElement for showing a ToolboxItem is for a beta feature.
14
+ *
15
+ * @extends {Component}
16
+ */
17
+class BetaTag extends Component<Props> {
18
+
19
+    /**
20
+     * Implements React's {@link Component#render()}.
21
+     *
22
+     * @inheritdoc
23
+     * @returns {ReactElement}
24
+     */
25
+    render() {
26
+        return (
27
+            <Container className = 'beta-tag'>
28
+                <Text>
29
+                    { this.props.t('recording.beta') }
30
+                </Text>
31
+            </Container>
32
+        );
33
+    }
34
+}
35
+
36
+export default translate(BetaTag);

+ 1
- 0
react/features/base/toolbox/components/index.js 查看文件

@@ -5,4 +5,5 @@ export { default as AbstractButton } from './AbstractButton';
5 5
 export type { Props as AbstractButtonProps } from './AbstractButton';
6 6
 export { default as AbstractHangupButton } from './AbstractHangupButton';
7 7
 export { default as AbstractVideoMuteButton } from './AbstractVideoMuteButton';
8
+export { default as BetaTag } from './BetaTag';
8 9
 export { default as OverflowMenuItem } from './OverflowMenuItem';

+ 15
- 1
react/features/blur/components/VideoBlurButton.js 查看文件

@@ -1,9 +1,11 @@
1 1
 // @flow
2 2
 
3
+import React from 'react';
4
+
3 5
 import { createVideoBlurEvent, sendAnalytics } from '../../analytics';
4 6
 import { translate } from '../../base/i18n';
5 7
 import { connect } from '../../base/redux';
6
-import { AbstractButton } from '../../base/toolbox';
8
+import { AbstractButton, BetaTag } from '../../base/toolbox';
7 9
 import type { AbstractButtonProps } from '../../base/toolbox';
8 10
 
9 11
 import { toggleBlurEffect } from '../actions';
@@ -35,6 +37,18 @@ class VideoBlurButton extends AbstractButton<Props, *> {
35 37
     tooltip = 'toolbar.startvideoblur';
36 38
     toggledLabel = 'toolbar.stopvideoblur';
37 39
 
40
+    /**
41
+     * Helper function to be implemented by subclasses, which returns
42
+     * a React Element to display (a beta tag) at the end of the button.
43
+     *
44
+     * @override
45
+     * @protected
46
+     * @returns {ReactElement}
47
+     */
48
+    _getElementAfter() {
49
+        return <BetaTag />;
50
+    }
51
+
38 52
     /**
39 53
      * Handles clicking / pressing the button, and toggles the blur effect
40 54
      * state accordingly.

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

@@ -3,8 +3,8 @@
3 3
 import React from 'react';
4 4
 
5 5
 import { translate } from '../../../../base/i18n';
6
-import { Container, Text } from '../../../../base/react';
7 6
 import { connect } from '../../../../base/redux';
7
+import { BetaTag } from '../../../../base/toolbox';
8 8
 
9 9
 import AbstractLiveStreamButton, {
10 10
     _mapStateToProps as _abstractMapStateToProps,
@@ -46,14 +46,7 @@ class LiveStreamButton extends AbstractLiveStreamButton<Props> {
46 46
      * @returns {ReactElement}
47 47
      */
48 48
     _getElementAfter() {
49
-        return (
50
-            <Container
51
-                className = { 'beta-tag' }>
52
-                <Text>
53
-                    { this.props.t('recording.beta') }
54
-                </Text>
55
-            </Container>
56
-        );
49
+        return <BetaTag />;
57 50
     }
58 51
 
59 52
     /**

Loading…
取消
儲存