瀏覽代碼

Merge pull request #1217 from BeatC/fix-watermarks

Fixes issue with watermarks and interface configs.
j8
Дамян Минков 8 年之前
父節點
當前提交
c46772015b
共有 1 個檔案被更改,包括 95 行新增12 行删除
  1. 95
    12
      react/features/conference/components/Conference.web.js

+ 95
- 12
react/features/conference/components/Conference.web.js 查看文件

@@ -1,3 +1,4 @@
1
+/* global interfaceConfig */
1 2
 import React, { Component } from 'react';
2 3
 
3 4
 /**
@@ -13,6 +14,30 @@ const DISPLAY_NONE_STYLE = {
13 14
  */
14 15
 export default class Conference extends Component {
15 16
 
17
+    /**
18
+     * Initializes Conference component instance.
19
+     *
20
+     * @param {Object} props - The read-only properties with which the new
21
+     * instance is to be initialized.
22
+     */
23
+    constructor(props) {
24
+        super(props);
25
+
26
+        const showBrandWatermark = interfaceConfig.SHOW_BRAND_WATERMARK;
27
+        const showJitsiWatermark = interfaceConfig.SHOW_JITSI_WATERMARK;
28
+
29
+        this.state = {
30
+            ...this.state,
31
+            showBrandWatermark,
32
+            showJitsiWatermark,
33
+            brandWatermarkLink:
34
+                showBrandWatermark ? interfaceConfig.BRAND_WATERMARK_LINK : '',
35
+            jitsiWatermarkLink:
36
+                showJitsiWatermark ? interfaceConfig.JITSI_WATERMARK_LINK : '',
37
+            showPoweredBy: interfaceConfig.SHOW_POWERED_BY
38
+        };
39
+    }
40
+
16 41
     /**
17 42
      * Implements React's {@link Component#render()}.
18 43
      *
@@ -55,18 +80,15 @@ export default class Conference extends Component {
55 80
                             <div id = 'sharedVideoIFrame' />
56 81
                         </div>
57 82
                         <div id = 'etherpad' />
58
-                        <a target = '_new'>
59
-                            <div className = 'watermark leftwatermark' />
60
-                        </a>
61
-                        <a target = '_new'>
62
-                            <div className = 'watermark rightwatermark' />
63
-                        </a>
64
-                        <a
65
-                            className = 'poweredby hide'
66
-                            href = 'http://jitsi.org'
67
-                            target = '_new'>
68
-                            <span data-i18n = 'poweredby' /> jitsi.org
69
-                        </a>
83
+                        {
84
+                            this._renderJitsiWatermark()
85
+                        }
86
+                        {
87
+                            this._renderBrandWatermark()
88
+                        }
89
+                        {
90
+                            this._renderPoweredBy()
91
+                        }
70 92
                         <div id = 'dominantSpeaker'>
71 93
                             <div className = 'dynamic-shadow' />
72 94
                             <img
@@ -130,4 +152,65 @@ export default class Conference extends Component {
130 152
             </div>
131 153
         );
132 154
     }
155
+
156
+    /**
157
+     * Method that returns brand watermark element if it is enabled.
158
+     *
159
+     * @returns {ReactElement|null}
160
+     * @private
161
+     */
162
+    _renderBrandWatermark() {
163
+        if (this.state.showBrandWatermark) {
164
+            return (
165
+                <a
166
+                    href = { this.state.brandWatermarkLink }
167
+                    target = '_new'>
168
+                    <div className = 'watermark rightwatermark' />
169
+                </a>
170
+            );
171
+        }
172
+
173
+        return null;
174
+    }
175
+
176
+    /**
177
+     * Method that returns jitsi watermark element if it is enabled.
178
+     *
179
+     * @returns {ReactElement|null}
180
+     * @private
181
+     */
182
+    _renderJitsiWatermark() {
183
+        if (this.state.showJitsiWatermark) {
184
+            return (
185
+                <a
186
+                    href = { this.state.jitsiWatermarkLink }
187
+                    target = '_new'>
188
+                    <div className = 'watermark leftwatermark' />
189
+                </a>
190
+            );
191
+        }
192
+
193
+        return null;
194
+    }
195
+
196
+    /**
197
+     * Renders powered by block if it is enabled.
198
+     *
199
+     * @returns {ReactElement|null}
200
+     * @private
201
+     */
202
+    _renderPoweredBy() {
203
+        if (this.state.showPoweredBy) {
204
+            return (
205
+                <a
206
+                    className = 'poweredby hide'
207
+                    href = 'http://jitsi.org'
208
+                    target = '_new'>
209
+                    <span data-i18n = 'poweredby' /> jitsi.org
210
+                </a>
211
+            );
212
+        }
213
+
214
+        return null;
215
+    }
133 216
 }

Loading…
取消
儲存