Переглянути джерело

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 роки тому
джерело
коміт
6efad1348a

+ 1
- 32
modules/UI/videolayout/LargeVideoManager.js Переглянути файл

1
-/* global $, APP, interfaceConfig */
1
+/* global $, APP */
2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
2
 const logger = require("jitsi-meet-logger").getLogger(__filename);
3
 
3
 
4
 import Avatar from "../avatar/Avatar";
4
 import Avatar from "../avatar/Avatar";
37
             display: 'inline-block'
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
         this.$container.hover(
40
         this.$container.hover(
72
             e => this.onHoverIn(e),
41
             e => this.onHoverIn(e),
73
             e => this.onHoverOut(e)
42
             e => this.onHoverOut(e)

+ 0
- 0
react/features/base/react/components/Watermarks.native.js Переглянути файл


+ 134
- 0
react/features/base/react/components/Watermarks.web.js Переглянути файл

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 Переглянути файл

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

+ 5
- 101
react/features/conference/components/Conference.web.js Переглянути файл

1
-/* global $, APP, interfaceConfig */
1
+/* global $, APP */
2
 
2
 
3
 import React, { Component } from 'react';
3
 import React, { Component } from 'react';
4
 import { connect as reactReduxConnect } from 'react-redux';
4
 import { connect as reactReduxConnect } from 'react-redux';
5
 
5
 
6
 import { connect, disconnect } from '../../base/connection';
6
 import { connect, disconnect } from '../../base/connection';
7
+import { Watermarks } from '../../base/react';
7
 
8
 
8
 /**
9
 /**
9
  * For legacy reasons, inline style for display none.
10
  * For legacy reasons, inline style for display none.
53
         this.props.dispatch(disconnect());
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
      * Implements React's {@link Component#render()}.
58
      * Implements React's {@link Component#render()}.
86
      *
59
      *
123
                             <div id = 'sharedVideoIFrame' />
96
                             <div id = 'sharedVideoIFrame' />
124
                         </div>
97
                         </div>
125
                         <div id = 'etherpad' />
98
                         <div id = 'etherpad' />
126
-                        {
127
-                            this._renderJitsiWatermark()
128
-                        }
129
-                        {
130
-                            this._renderBrandWatermark()
131
-                        }
132
-                        {
133
-                            this._renderPoweredBy()
134
-                        }
99
+
100
+                        <Watermarks />
101
+
135
                         <div id = 'dominantSpeaker'>
102
                         <div id = 'dominantSpeaker'>
136
                             <div className = 'dynamic-shadow' />
103
                             <div className = 'dynamic-shadow' />
137
                             <img
104
                             <img
195
             </div>
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
 export default reactReduxConnect()(Conference);
167
 export default reactReduxConnect()(Conference);

+ 18
- 113
react/features/welcome/components/WelcomePage.web.js Переглянути файл

3
 import React from 'react';
3
 import React from 'react';
4
 import { connect } from 'react-redux';
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
 /* eslint-disable require-jsdoc */
10
 /* eslint-disable require-jsdoc */
16
 
11
 
32
     constructor(props) {
27
     constructor(props) {
33
         super(props);
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
         // Bind event handlers so they are only bound once for every instance.
38
         // Bind event handlers so they are only bound once for every instance.
38
         this._onDisableWelcomeChange = this._onDisableWelcomeChange.bind(this);
39
         this._onDisableWelcomeChange = this._onDisableWelcomeChange.bind(this);
63
      */
64
      */
64
     render() {
65
     render() {
65
         return (
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
             </div>
74
             </div>
76
         );
75
         );
77
     }
76
     }
86
         return `${window.location.protocol}//${window.location.host}/`;
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
      * Handles <tt>change</tt> event of the checkbox which allows specifying
89
      * Handles <tt>change</tt> event of the checkbox which allows specifying
115
      * whether the WelcomePage is disabled.
90
      * whether the WelcomePage is disabled.
154
         super._onRoomChange(event.target.value);
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
      * Renders a feature with a specific index.
133
      * Renders a feature with a specific index.
181
      *
134
      *
239
 
192
 
240
         return (
193
         return (
241
             <div id = 'welcome_page_header'>
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
                 <div id = 'enter_room_container'>
197
                 <div id = 'enter_room_container'>
252
                     <div id = 'enter_room_form'>
198
                     <div id = 'enter_room_form'>
253
                         <div className = 'domain-name'>
199
                         <div className = 'domain-name'>
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
      * Renders the main part of this WelcomePage.
249
      * Renders the main part of this WelcomePage.
345
      *
250
      *

Завантаження…
Відмінити
Зберегти