Browse Source

Fix the display of watermarks in film strip-only mode

Recently, we reimplemented the watermarks in React. Unfortunately, we
didn't take into account film strip-only mode.

Additionally, we duplicated watermark-related source code on the Welcome
and Conference pages.
j8
Lyubomir Marinov 8 years ago
parent
commit
6efad1348a

+ 1
- 32
modules/UI/videolayout/LargeVideoManager.js View File

@@ -1,4 +1,4 @@
1
-/* global $, APP, interfaceConfig */
1
+/* global $, APP */
2 2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
3 3
 
4 4
 import Avatar from "../avatar/Avatar";
@@ -37,37 +37,6 @@ export default class LargeVideoManager {
37 37
             display: 'inline-block'
38 38
         });
39 39
 
40
-        if (interfaceConfig.SHOW_JITSI_WATERMARK
41
-            && !interfaceConfig.filmStripOnly) {
42
-            let leftWatermarkDiv
43
-                = this.$container.find("div.watermark.leftwatermark");
44
-
45
-            leftWatermarkDiv.css({display: 'block'});
46
-
47
-            UIUtil.setLinkHref(
48
-                leftWatermarkDiv.parent(),
49
-                interfaceConfig.JITSI_WATERMARK_LINK);
50
-        }
51
-
52
-        if (interfaceConfig.SHOW_BRAND_WATERMARK
53
-            && !interfaceConfig.filmStripOnly) {
54
-            let rightWatermarkDiv
55
-                = this.$container.find("div.watermark.rightwatermark");
56
-
57
-            rightWatermarkDiv.css({
58
-                display: 'block',
59
-                backgroundImage: 'url(images/rightwatermark.png)'
60
-            });
61
-
62
-            UIUtil.setLinkHref(
63
-                rightWatermarkDiv.parent(),
64
-                interfaceConfig.BRAND_WATERMARK_LINK);
65
-        }
66
-
67
-        if (interfaceConfig.SHOW_POWERED_BY) {
68
-            this.$container.children("a.poweredby").css({display: 'block'});
69
-        }
70
-
71 40
         this.$container.hover(
72 41
             e => this.onHoverIn(e),
73 42
             e => this.onHoverOut(e)

+ 0
- 0
react/features/base/react/components/Watermarks.native.js View File


+ 134
- 0
react/features/base/react/components/Watermarks.web.js View File

@@ -0,0 +1,134 @@
1
+/* global APP, interfaceConfig */
2
+
3
+import React, { Component } from 'react';
4
+
5
+/**
6
+ * The CSS style of the element with CSS class <tt>rightwatermark</tt>.
7
+ */
8
+const RIGHT_WATERMARK_STYLE = {
9
+    backgroundImage: 'url(images/rightwatermark.png)'
10
+};
11
+
12
+/**
13
+ * A Web Component which renders watermarks such as Jits, brand, powered by,
14
+ * etc.
15
+ */
16
+export class Watermarks extends Component {
17
+    /**
18
+     * Initializes a new Watermarks 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
27
+            = interfaceConfig.SHOW_BRAND_WATERMARK
28
+                && !interfaceConfig.filmStripOnly;
29
+        const showJitsiWatermark
30
+            = interfaceConfig.SHOW_JITSI_WATERMARK
31
+                && !interfaceConfig.filmStripOnly;
32
+        const showJitsiWatermarkForGuests
33
+            = interfaceConfig.SHOW_WATERMARK_FOR_GUESTS;
34
+
35
+        this.state = {
36
+            brandWatermarkLink:
37
+                showBrandWatermark ? interfaceConfig.BRAND_WATERMARK_LINK : '',
38
+            jitsiWatermarkLink:
39
+                showJitsiWatermark || showJitsiWatermarkForGuests
40
+                    ? interfaceConfig.JITSI_WATERMARK_LINK : '',
41
+            showBrandWatermark,
42
+            showJitsiWatermark,
43
+            showJitsiWatermarkForGuests,
44
+            showPoweredBy: interfaceConfig.SHOW_POWERED_BY
45
+        };
46
+    }
47
+
48
+    /**
49
+     * Implements React's {@link Component#render()}.
50
+     *
51
+     * @inheritdoc
52
+     * @returns {ReactElement}
53
+     */
54
+    render() {
55
+        return (
56
+            <div>
57
+                {
58
+                    this._renderJitsiWatermark()
59
+                }
60
+                {
61
+                    this._renderBrandWatermark()
62
+                }
63
+                {
64
+                    this._renderPoweredBy()
65
+                }
66
+            </div>
67
+        );
68
+    }
69
+
70
+    /**
71
+     * Renders a brand watermark if it is enabled.
72
+     *
73
+     * @private
74
+     * @returns {ReactElement|null} Watermark element or null.
75
+     */
76
+    _renderBrandWatermark() {
77
+        if (this.state.showBrandWatermark) {
78
+            return (
79
+                <a
80
+                    href = { this.state.brandWatermarkLink }
81
+                    target = '_new'>
82
+                    <div
83
+                        className = 'watermark rightwatermark'
84
+                        style = { RIGHT_WATERMARK_STYLE } />
85
+                </a>
86
+            );
87
+        }
88
+
89
+        return null;
90
+    }
91
+
92
+    /**
93
+     * Renders a Jitsi watermark if it is enabled.
94
+     *
95
+     * @private
96
+     * @returns {ReactElement|null}
97
+     */
98
+    _renderJitsiWatermark() {
99
+        if (this.state.showJitsiWatermark
100
+            || (APP.tokenData.isGuest
101
+                    && this.state.showJitsiWatermarkForGuests)) {
102
+            return (
103
+                <a
104
+                    href = { this.state.jitsiWatermarkLink }
105
+                    target = '_new'>
106
+                    <div className = 'watermark leftwatermark' />
107
+                </a>
108
+            );
109
+        }
110
+
111
+        return null;
112
+    }
113
+
114
+    /**
115
+     * Renders a powered by block if it is enabled.
116
+     *
117
+     * @private
118
+     * @returns {ReactElement|null}
119
+     */
120
+    _renderPoweredBy() {
121
+        if (this.state.showPoweredBy) {
122
+            return (
123
+                <a
124
+                    className = 'poweredby'
125
+                    href = 'http://jitsi.org'
126
+                    target = '_new'>
127
+                    <span data-i18n = 'poweredby' /> jitsi.org
128
+                </a>
129
+            );
130
+        }
131
+
132
+        return null;
133
+    }
134
+}

+ 1
- 0
react/features/base/react/components/index.js View File

@@ -1,2 +1,3 @@
1 1
 export * from './Container';
2 2
 export * from './Link';
3
+export * from './Watermarks';

+ 5
- 101
react/features/conference/components/Conference.web.js View File

@@ -1,9 +1,10 @@
1
-/* global $, APP, interfaceConfig */
1
+/* global $, APP */
2 2
 
3 3
 import React, { Component } from 'react';
4 4
 import { connect as reactReduxConnect } from 'react-redux';
5 5
 
6 6
 import { connect, disconnect } from '../../base/connection';
7
+import { Watermarks } from '../../base/react';
7 8
 
8 9
 /**
9 10
  * For legacy reasons, inline style for display none.
@@ -53,34 +54,6 @@ class Conference extends Component {
53 54
         this.props.dispatch(disconnect());
54 55
     }
55 56
 
56
-    /**
57
-     * Initializes Conference component instance.
58
-     *
59
-     * @param {Object} props - The read-only properties with which the new
60
-     * instance is to be initialized.
61
-     */
62
-    constructor(props) {
63
-        super(props);
64
-
65
-        const showBrandWatermark = interfaceConfig.SHOW_BRAND_WATERMARK;
66
-        const showJitsiWatermark = interfaceConfig.SHOW_JITSI_WATERMARK;
67
-        const showJitsiWatermarkForGuest
68
-            = interfaceConfig.SHOW_WATERMARK_FOR_GUESTS;
69
-
70
-        this.state = {
71
-            ...this.state,
72
-            showBrandWatermark,
73
-            showJitsiWatermark,
74
-            showJitsiWatermarkForGuest,
75
-            brandWatermarkLink:
76
-                showBrandWatermark ? interfaceConfig.BRAND_WATERMARK_LINK : '',
77
-            jitsiWatermarkLink:
78
-                showJitsiWatermark || showJitsiWatermarkForGuest
79
-                    ? interfaceConfig.JITSI_WATERMARK_LINK : '',
80
-            showPoweredBy: interfaceConfig.SHOW_POWERED_BY
81
-        };
82
-    }
83
-
84 57
     /**
85 58
      * Implements React's {@link Component#render()}.
86 59
      *
@@ -123,15 +96,9 @@ class Conference extends Component {
123 96
                             <div id = 'sharedVideoIFrame' />
124 97
                         </div>
125 98
                         <div id = 'etherpad' />
126
-                        {
127
-                            this._renderJitsiWatermark()
128
-                        }
129
-                        {
130
-                            this._renderBrandWatermark()
131
-                        }
132
-                        {
133
-                            this._renderPoweredBy()
134
-                        }
99
+
100
+                        <Watermarks />
101
+
135 102
                         <div id = 'dominantSpeaker'>
136 103
                             <div className = 'dynamic-shadow' />
137 104
                             <img
@@ -195,69 +162,6 @@ class Conference extends Component {
195 162
             </div>
196 163
         );
197 164
     }
198
-
199
-    /**
200
-     * Method that returns brand watermark element if it is enabled.
201
-     *
202
-     * @returns {ReactElement|null}
203
-     * @private
204
-     */
205
-    _renderBrandWatermark() {
206
-        if (this.state.showBrandWatermark) {
207
-            return (
208
-                <a
209
-                    href = { this.state.brandWatermarkLink }
210
-                    target = '_new'>
211
-                    <div className = 'watermark rightwatermark' />
212
-                </a>
213
-            );
214
-        }
215
-
216
-        return null;
217
-    }
218
-
219
-    /**
220
-     * Method that returns jitsi watermark element if it is enabled.
221
-     *
222
-     * @returns {ReactElement|null}
223
-     * @private
224
-     */
225
-    _renderJitsiWatermark() {
226
-        if (this.state.showJitsiWatermark
227
-            || (APP.tokenData.isGuest
228
-                    && this.state.showJitsiWatermarkForGuest)) {
229
-            return (
230
-                <a
231
-                    href = { this.state.jitsiWatermarkLink }
232
-                    target = '_new'>
233
-                    <div className = 'watermark leftwatermark' />
234
-                </a>
235
-            );
236
-        }
237
-
238
-        return null;
239
-    }
240
-
241
-    /**
242
-     * Renders powered by block if it is enabled.
243
-     *
244
-     * @returns {ReactElement|null}
245
-     * @private
246
-     */
247
-    _renderPoweredBy() {
248
-        if (this.state.showPoweredBy) {
249
-            return (
250
-                <a
251
-                    className = 'poweredby hide'
252
-                    href = 'http://jitsi.org'
253
-                    target = '_new'>
254
-                    <span data-i18n = 'poweredby' /> jitsi.org
255
-                </a>
256
-            );
257
-        }
258
-
259
-        return null;
260
-    }
261 165
 }
262 166
 
263 167
 export default reactReduxConnect()(Conference);

+ 18
- 113
react/features/welcome/components/WelcomePage.web.js View File

@@ -3,14 +3,9 @@
3 3
 import React from 'react';
4 4
 import { connect } from 'react-redux';
5 5
 
6
-import { AbstractWelcomePage, mapStateToProps } from './AbstractWelcomePage';
6
+import { Watermarks } from '../../base/react';
7 7
 
8
-/**
9
- * The CSS style of the element with CSS class <tt>rightwatermark</tt>.
10
- */
11
-const RIGHT_WATERMARK_STYLE = {
12
-    backgroundImage: 'url(images/rightwatermark.png)'
13
-};
8
+import { AbstractWelcomePage, mapStateToProps } from './AbstractWelcomePage';
14 9
 
15 10
 /* eslint-disable require-jsdoc */
16 11
 
@@ -32,7 +27,13 @@ class WelcomePage extends AbstractWelcomePage {
32 27
     constructor(props) {
33 28
         super(props);
34 29
 
35
-        this._initState();
30
+        this.state = {
31
+            ...this.state,
32
+
33
+            enableWelcomePage: true,
34
+            generateRoomnames:
35
+                interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE
36
+        };
36 37
 
37 38
         // Bind event handlers so they are only bound once for every instance.
38 39
         this._onDisableWelcomeChange = this._onDisableWelcomeChange.bind(this);
@@ -63,15 +64,13 @@ class WelcomePage extends AbstractWelcomePage {
63 64
      */
64 65
     render() {
65 66
         return (
66
-            <div>
67
-                <div id = 'welcome_page'>
68
-                    {
69
-                        this._renderHeader()
70
-                    }
71
-                    {
72
-                        this._renderMain()
73
-                    }
74
-                </div>
67
+            <div id = 'welcome_page'>
68
+                {
69
+                    this._renderHeader()
70
+                }
71
+                {
72
+                    this._renderMain()
73
+                }
75 74
             </div>
76 75
         );
77 76
     }
@@ -86,30 +85,6 @@ class WelcomePage extends AbstractWelcomePage {
86 85
         return `${window.location.protocol}//${window.location.host}/`;
87 86
     }
88 87
 
89
-    /**
90
-     * Method that initializes state of the component.
91
-     *
92
-     * @returns {void}
93
-     */
94
-    _initState() {
95
-        const showBrandWatermark = interfaceConfig.SHOW_BRAND_WATERMARK;
96
-        const showJitsiWatermark = interfaceConfig.SHOW_JITSI_WATERMARK;
97
-
98
-        this.state = {
99
-            ...this.state,
100
-            brandWatermarkLink:
101
-                showBrandWatermark ? interfaceConfig.BRAND_WATERMARK_LINK : '',
102
-            enableWelcomePage: true,
103
-            generateRoomnames:
104
-                interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE,
105
-            jitsiWatermarkLink:
106
-                showJitsiWatermark ? interfaceConfig.JITSI_WATERMARK_LINK : '',
107
-            showBrandWatermark,
108
-            showJitsiWatermark,
109
-            showPoweredBy: interfaceConfig.SHOW_POWERED_BY
110
-        };
111
-    }
112
-
113 88
     /**
114 89
      * Handles <tt>change</tt> event of the checkbox which allows specifying
115 90
      * whether the WelcomePage is disabled.
@@ -154,28 +129,6 @@ class WelcomePage extends AbstractWelcomePage {
154 129
         super._onRoomChange(event.target.value);
155 130
     }
156 131
 
157
-    /**
158
-     * Method that returns brand watermark element if it is enabled.
159
-     *
160
-     * @private
161
-     * @returns {ReactElement|null} Watermark element or null.
162
-     */
163
-    _renderBrandWatermark() {
164
-        if (this.state.showBrandWatermark) {
165
-            return (
166
-                <a
167
-                    href = { this.state.brandWatermarkLink }
168
-                    target = '_new'>
169
-                    <div
170
-                        className = 'watermark rightwatermark'
171
-                        style = { RIGHT_WATERMARK_STYLE } />
172
-                </a>
173
-            );
174
-        }
175
-
176
-        return null;
177
-    }
178
-
179 132
     /**
180 133
      * Renders a feature with a specific index.
181 134
      *
@@ -239,15 +192,8 @@ class WelcomePage extends AbstractWelcomePage {
239 192
 
240 193
         return (
241 194
             <div id = 'welcome_page_header'>
242
-                {
243
-                    this._renderJitsiWatermark()
244
-                }
245
-                {
246
-                    this._renderBrandWatermark()
247
-                }
248
-                {
249
-                    this._renderPoweredBy()
250
-                }
195
+                <Watermarks />
196
+
251 197
                 <div id = 'enter_room_container'>
252 198
                     <div id = 'enter_room_form'>
253 199
                         <div className = 'domain-name'>
@@ -299,47 +245,6 @@ class WelcomePage extends AbstractWelcomePage {
299 245
         );
300 246
     }
301 247
 
302
-    /**
303
-     * Method that returns jitsi watermark element if it is enabled.
304
-     *
305
-     * @private
306
-     * @returns {ReactElement|null} Watermark element or null.
307
-     */
308
-    _renderJitsiWatermark() {
309
-        if (this.state.showJitsiWatermark) {
310
-            return (
311
-                <a
312
-                    href = { this.state.jitsiWatermarkLink }
313
-                    target = '_new'>
314
-                    <div className = 'watermark leftwatermark' />
315
-                </a>
316
-            );
317
-        }
318
-
319
-        return null;
320
-    }
321
-
322
-    /**
323
-     * Renders powered by block if it is enabled.
324
-     *
325
-     * @private
326
-     * @returns {ReactElement|null}
327
-     */
328
-    _renderPoweredBy() {
329
-        if (this.state.showPoweredBy) {
330
-            return (
331
-                <a
332
-                    className = 'poweredby'
333
-                    href = 'http://jitsi.org'
334
-                    target = '_new'>
335
-                    <span data-i18n = 'poweredby' /> jitsi.org
336
-                </a>
337
-            );
338
-        }
339
-
340
-        return null;
341
-    }
342
-
343 248
     /**
344 249
      * Renders the main part of this WelcomePage.
345 250
      *

Loading…
Cancel
Save