Browse Source

feat(welcome): add posibility to extend settings toolbar

master
Mihai Uscat 5 years ago
parent
commit
5ade0cad8b

+ 1
- 0
css/_settings_toolbar.scss View File

@@ -0,0 +1 @@
1
+/** Insert custom CSS for any additional content in the welcome page settings toolbar **/

+ 1
- 0
index.html View File

@@ -148,6 +148,7 @@
148 148
     <!--#include virtual="title.html" -->
149 149
     <!--#include virtual="plugin.head.html" -->
150 150
     <!--#include virtual="static/welcomePageAdditionalContent.html" -->
151
+    <!--#include virtual="static/settingsToolbarAdditionalContent.html" -->
151 152
   </head>
152 153
   <body>
153 154
     <div id="react"></div>

+ 1
- 0
interface_config.js View File

@@ -27,6 +27,7 @@ var interfaceConfig = {
27 27
     SHOW_DEEP_LINKING_IMAGE: false,
28 28
     GENERATE_ROOMNAMES_ON_WELCOME_PAGE: true,
29 29
     DISPLAY_WELCOME_PAGE_CONTENT: true,
30
+    DISPLAY_WELCOME_PAGE_TOOLBAR_CONTENT: false,
30 31
     APP_NAME: 'Jitsi Meet',
31 32
     NATIVE_APP_NAME: 'Jitsi Meet',
32 33
     PROVIDER_NAME: 'Jitsi',

+ 62
- 0
react/features/welcome/components/WelcomePage.web.js View File

@@ -53,6 +53,15 @@ class WelcomePage extends AbstractWelcomePage {
53 53
          */
54 54
         this._additionalContentRef = null;
55 55
 
56
+        /**
57
+         * The HTML Element used as the container for additional toolbar content. Used
58
+         * for directly appending the additional content template to the dom.
59
+         *
60
+         * @private
61
+         * @type {HTMLTemplateElement|null}
62
+         */
63
+        this._additionalToolbarContentRef = null;
64
+
56 65
         /**
57 66
          * The template to use as the main content for the welcome page. If
58 67
          * not found then only the welcome page head will display.
@@ -63,11 +72,24 @@ class WelcomePage extends AbstractWelcomePage {
63 72
         this._additionalContentTemplate = document.getElementById(
64 73
             'welcome-page-additional-content-template');
65 74
 
75
+        /**
76
+         * The template to use as the additional content for the welcome page header toolbar.
77
+         * If not found then only the settings icon will be displayed.
78
+         *
79
+         * @private
80
+         * @type {HTMLTemplateElement|null}
81
+         */
82
+        this._additionalToolbarContentTemplate = document.getElementById(
83
+            'settings-toolbar-additional-content-template'
84
+        );
85
+
66 86
         // Bind event handlers so they are only bound once per instance.
67 87
         this._onFormSubmit = this._onFormSubmit.bind(this);
68 88
         this._onRoomChange = this._onRoomChange.bind(this);
69 89
         this._setAdditionalContentRef
70 90
             = this._setAdditionalContentRef.bind(this);
91
+        this._setAdditionalToolbarContentRef
92
+            = this._setAdditionalToolbarContentRef.bind(this);
71 93
         this._onTabSelected = this._onTabSelected.bind(this);
72 94
     }
73 95
 
@@ -90,6 +112,12 @@ class WelcomePage extends AbstractWelcomePage {
90 112
             this._additionalContentRef.appendChild(
91 113
                 this._additionalContentTemplate.content.cloneNode(true));
92 114
         }
115
+
116
+        if (this._shouldShowAdditionalToolbarContent()) {
117
+            this._additionalToolbarContentRef.appendChild(
118
+                this._additionalToolbarContentTemplate.content.cloneNode(true)
119
+            );
120
+        }
93 121
     }
94 122
 
95 123
     /**
@@ -114,6 +142,7 @@ class WelcomePage extends AbstractWelcomePage {
114 142
         const { t } = this.props;
115 143
         const { APP_NAME } = interfaceConfig;
116 144
         const showAdditionalContent = this._shouldShowAdditionalContent();
145
+        const showAdditionalToolbarContent = this._shouldShowAdditionalToolbarContent();
117 146
 
118 147
         return (
119 148
             <div
@@ -127,6 +156,12 @@ class WelcomePage extends AbstractWelcomePage {
127 156
                     <div className = 'welcome-page-settings'>
128 157
                         <SettingsButton
129 158
                             defaultTab = { SETTINGS_TABS.CALENDAR } />
159
+                        { showAdditionalToolbarContent
160
+                            ? <div
161
+                                className = 'settings-toolbar-content'
162
+                                ref = { this._setAdditionalToolbarContentRef } />
163
+                            : null
164
+                        }
130 165
                     </div>
131 166
                     <div className = 'header-image' />
132 167
                     <div className = 'header-text'>
@@ -263,6 +298,19 @@ class WelcomePage extends AbstractWelcomePage {
263 298
         this._additionalContentRef = el;
264 299
     }
265 300
 
301
+    /**
302
+     * Sets the internal reference to the HTMLDivElement used to hold the
303
+     * toolbar additional content.
304
+     *
305
+     * @param {HTMLDivElement} el - The HTMLElement for the div that is the root
306
+     * of the additional toolbar content.
307
+     * @private
308
+     * @returns {void}
309
+     */
310
+    _setAdditionalToolbarContentRef(el) {
311
+        this._additionalToolbarContentRef = el;
312
+    }
313
+
266 314
     /**
267 315
      * Returns whether or not additional content should be displayed below
268 316
      * the welcome page's header for entering a room name.
@@ -276,6 +324,20 @@ class WelcomePage extends AbstractWelcomePage {
276 324
             && this._additionalContentTemplate.content
277 325
             && this._additionalContentTemplate.innerHTML.trim();
278 326
     }
327
+
328
+    /**
329
+     * Returns whether or not additional content should be displayed inside
330
+     * the header toolbar.
331
+     *
332
+     * @private
333
+     * @returns {boolean}
334
+     */
335
+    _shouldShowAdditionalToolbarContent() {
336
+        return interfaceConfig.DISPLAY_WELCOME_PAGE_TOOLBAR_CONTENT
337
+            && this._additionalToolbarContentTemplate
338
+            && this._additionalToolbarContentTemplate.content
339
+            && this._additionalToolbarContentTemplate.innerHTML.trim();
340
+    }
279 341
 }
280 342
 
281 343
 export default translate(connect(_mapStateToProps)(WelcomePage));

+ 1
- 0
static/settingsToolbarAdditionalContent.html View File

@@ -0,0 +1 @@
1
+<template id="settings-toolbar-additional-content-template"></template>

Loading…
Cancel
Save