瀏覽代碼

Move welcome page logic from jquery to react

master
Ilya Daynatovich 9 年之前
父節點
當前提交
984a6519fc

+ 1
- 4
css/_base.scss 查看文件

84
 }
84
 }
85
 
85
 
86
 .leftwatermark {
86
 .leftwatermark {
87
-    display: none;
88
     left: $defaultToolbarSize;
87
     left: $defaultToolbarSize;
89
     margin-left: 10px;
88
     margin-left: 10px;
90
     background-image: url($defaultWatermarkLink);
89
     background-image: url($defaultWatermarkLink);
92
 }
91
 }
93
 
92
 
94
 .rightwatermark {
93
 .rightwatermark {
95
-    display: none;
96
     right: 15;
94
     right: 15;
97
     background-position: center right;
95
     background-position: center right;
98
 }
96
 }
99
 
97
 
100
 .poweredby {
98
 .poweredby {
101
-    display: none;
102
     position: absolute;
99
     position: absolute;
103
     left: 25;
100
     left: 25;
104
     bottom: 7;
101
     bottom: 7;
142
 #inviteLinkRef {
139
 #inviteLinkRef {
143
     -webkit-user-select: text;
140
     -webkit-user-select: text;
144
     user-select: text;
141
     user-select: text;
145
-}
142
+}

+ 46
- 45
css/_welcome_page.scss 查看文件

50
     float: left;
50
     float: left;
51
 }
51
 }
52
 
52
 
53
-#domain_name
53
+.domain-name
54
 {
54
 {
55
     float: left;
55
     float: left;
56
     height: 55px;
56
     height: 55px;
61
     color: $defaultDarkColor;
61
     color: $defaultDarkColor;
62
 }
62
 }
63
 
63
 
64
-#enter_room_field {
65
-    font-size: 15px;
66
-    border: none;
67
-    -webkit-appearance: none;
68
-    width: 228px;
69
-    height: 55px;
70
-    line-height: 55px;
71
-    font-weight: 500;
72
-    box-shadow: none;
73
-    float: left;
74
-    background-color: #FFFFFF;
75
-    position: relative;
76
-    z-index: 2;
77
-}
78
-
79
-#enter_room_button {
80
-    width: 73px;
81
-    height: 45px;
82
-    background-color: #21B9FC;
83
-    moz-border-radius: 1px;
84
-    -webkit-border-radius: 1px;
85
-    color: #ffffff;
86
-    font-weight: 600;
87
-    border: none;
88
-    margin-top: 5px;
89
-    font-size: 19px;
90
-    padding-top: 6px;
91
-    outline: none;
92
-    float:left;
93
-    position: relative;
94
-    z-index: 2;
64
+.enter-room {
65
+    &__field {
66
+        font-size: 15px;
67
+        border: none;
68
+        -webkit-appearance: none;
69
+        width: 228px;
70
+        height: 55px;
71
+        line-height: 55px;
72
+        font-weight: 500;
73
+        box-shadow: none;
74
+        float: left;
75
+        background-color: #FFFFFF;
76
+        position: relative;
77
+        z-index: 2;
78
+    }
79
+
80
+    &__reload {
81
+        display: block;
82
+        width: 30px;
83
+        color: #acacac;
84
+        font-size: 1.9em;
85
+        line-height: 55px;
86
+        z-index: 3;
87
+        float:  left;
88
+        cursor: pointer;
89
+        text-align: center;
90
+    }
91
+
92
+    &__button {
93
+        width: 73px;
94
+        height: 45px;
95
+        background-color: #21B9FC;
96
+        moz-border-radius: 1px;
97
+        -webkit-border-radius: 1px;
98
+        color: #ffffff;
99
+        font-weight: 600;
100
+        border: none;
101
+        margin-top: 5px;
102
+        font-size: 19px;
103
+        padding-top: 6px;
104
+        outline: none;
105
+        float:left;
106
+        position: relative;
107
+        z-index: 2;
108
+    }
95
 }
109
 }
96
 
110
 
97
 #enter_room_container {
111
 #enter_room_container {
184
     line-height: 22px;
198
     line-height: 22px;
185
     font-weight: 200;
199
     font-weight: 200;
186
 }
200
 }
187
-
188
-#reload_roomname
189
-{
190
-    width: 30px;
191
-    color: #acacac;
192
-    font-size: 1.9em;
193
-    line-height: 55px;
194
-    z-index: 3;
195
-    float:  left;
196
-    cursor: pointer;
197
-    text-align: center;
198
-    display: none;
199
-}

+ 6
- 76
modules/UI/welcome_page/WelcomePage.js 查看文件

1
-/* global $, interfaceConfig, APP */
2
-
3
-import {
4
-    generateRoomWithoutSeparator
5
-} from '../../../react/features/base/util/roomnameGenerator';
6
-import UIUtil from '../util/UIUtil';
7
-
8
-var animateTimeout, updateTimeout;
1
+/* global $ */
9
 
2
 
10
 function enterRoom() {
3
 function enterRoom() {
11
     const $enterRoomField = $("#enter_room_field");
4
     const $enterRoomField = $("#enter_room_field");
12
 
5
 
13
     var val = $enterRoomField.val();
6
     var val = $enterRoomField.val();
14
     if(!val) {
7
     if(!val) {
15
-        val = $enterRoomField.attr("room_name");
8
+        val = $enterRoomField.data("room-name");
16
     }
9
     }
17
     if (val) {
10
     if (val) {
18
         window.location.pathname = "/" + val;
11
         window.location.pathname = "/" + val;
19
     }
12
     }
20
 }
13
 }
21
 
14
 
22
-function animate(word) {
23
-    var currentVal = $("#enter_room_field").attr("placeholder");
24
-    $("#enter_room_field").attr("placeholder", currentVal + word.substr(0, 1));
25
-    animateTimeout = setTimeout(function() {
26
-        animate(word.substring(1, word.length));
27
-    }, 70);
28
-}
29
-
30
-function update_roomname() {
31
-    var word = generateRoomWithoutSeparator();
32
-    $("#enter_room_field").attr("room_name", word);
33
-    $("#enter_room_field").attr("placeholder", "");
34
-    clearTimeout(animateTimeout);
35
-    animate(word);
36
-    updateTimeout = setTimeout(update_roomname, 10000);
37
-}
38
-
39
 function setupWelcomePage() {
15
 function setupWelcomePage() {
40
-    $("#videoconference_page").hide();
41
-    $("#domain_name").text(
42
-            window.location.protocol + "//" + window.location.host + "/");
43
-    if (interfaceConfig.SHOW_JITSI_WATERMARK) {
44
-        var leftWatermarkDiv =
45
-            $("#welcome_page_header div[class='watermark leftwatermark']");
46
-        if(leftWatermarkDiv && leftWatermarkDiv.length > 0) {
47
-            leftWatermarkDiv.css({display: 'block'});
48
-            UIUtil.setLinkHref(
49
-                leftWatermarkDiv.parent(),
50
-                interfaceConfig.JITSI_WATERMARK_LINK);
51
-        }
52
-    }
53
-
54
-    if (interfaceConfig.SHOW_BRAND_WATERMARK) {
55
-        var rightWatermarkDiv =
56
-            $("#welcome_page_header div[class='watermark rightwatermark']");
57
-        if(rightWatermarkDiv && rightWatermarkDiv.length > 0) {
58
-            rightWatermarkDiv.css({display: 'block'});
59
-            UIUtil.setLinkHref(
60
-                rightWatermarkDiv.parent(),
61
-                interfaceConfig.BRAND_WATERMARK_LINK);
62
-            rightWatermarkDiv.get(0).style.backgroundImage =
63
-                "url(images/rightwatermark.png)";
64
-        }
65
-    }
66
-
67
-    if (interfaceConfig.SHOW_POWERED_BY) {
68
-        $("#welcome_page_header>a[class='poweredby']")
69
-            .css({display: 'block'});
70
-    }
16
+    /*
17
+    * XXX: We left only going to conference page here because transitions via
18
+    * React Router isn't implemented yet.
19
+    */
71
 
20
 
72
     $("#enter_room_button").click(function() {
21
     $("#enter_room_button").click(function() {
73
         enterRoom();
22
         enterRoom();
78
             enterRoom();
27
             enterRoom();
79
         }
28
         }
80
     });
29
     });
81
-
82
-    if (interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE !== false) {
83
-        var selector = $("#reload_roomname");
84
-        selector.click(function () {
85
-            clearTimeout(updateTimeout);
86
-            clearTimeout(animateTimeout);
87
-            update_roomname();
88
-        });
89
-        selector.show();
90
-
91
-        update_roomname();
92
-    }
93
-
94
-    $("#disable_welcome").click(function () {
95
-        APP.settings.setWelcomePageEnabled(
96
-            !$("#disable_welcome").is(":checked")
97
-        );
98
-    });
99
-
100
 }
30
 }
101
 
31
 
102
 module.exports = setupWelcomePage;
32
 module.exports = setupWelcomePage;

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

62
                             <div className = 'watermark rightwatermark' />
62
                             <div className = 'watermark rightwatermark' />
63
                         </a>
63
                         </a>
64
                         <a
64
                         <a
65
-                            className = 'poweredby'
65
+                            className = 'poweredby hide'
66
                             href = 'http://jitsi.org'
66
                             href = 'http://jitsi.org'
67
                             target = '_new'>
67
                             target = '_new'>
68
                             <span data-i18n = 'poweredby' /> jitsi.org
68
                             <span data-i18n = 'poweredby' /> jitsi.org

+ 95
- 6
react/features/welcome/components/AbstractWelcomePage.js 查看文件

4
 import { isRoomValid } from '../../base/conference';
4
 import { isRoomValid } from '../../base/conference';
5
 import { VideoTrack } from '../../base/media';
5
 import { VideoTrack } from '../../base/media';
6
 import { getLocalVideoTrack } from '../../base/tracks';
6
 import { getLocalVideoTrack } from '../../base/tracks';
7
+import { generateRoomWithoutSeparator } from '../../base/util';
7
 
8
 
8
 /**
9
 /**
9
  * Base (abstract) class for container component rendering the welcome page.
10
  * Base (abstract) class for container component rendering the welcome page.
34
         /**
35
         /**
35
          * Save room name into component's local state.
36
          * Save room name into component's local state.
36
          *
37
          *
37
-         * @type {{room: string}}
38
+         * @type {Object}
39
+         * @property {string} room - Room name.
40
+         * @property {string} roomPlaceholder - Room placeholder
41
+         * that's used as a placeholder for input.
42
+         * @property {string} generatedRoomname - Automatically generated
43
+         * room name.
44
+         * @property {number|null} animateTimeoutId - Identificator for
45
+         * letter animation timeout.
46
+         * @property {nubmer|null} updateTimeoutId - Identificator for
47
+         * updating generated room name.
38
          */
48
          */
39
         this.state = {
49
         this.state = {
40
-            room: ''
50
+            room: '',
51
+            roomPlaceholder: '',
52
+            generatedRoomname: '',
53
+            animateTimeoutId: null,
54
+            updateTimeoutId: null
41
         };
55
         };
42
 
56
 
43
         // Bind event handlers so they are only bound once for every instance.
57
         // Bind event handlers so they are only bound once for every instance.
44
-        this._onJoinClick = this._onJoinClick.bind(this);
58
+        const roomnameChanging = this._animateRoomnameChanging.bind(this);
59
+
60
+        this._onJoin = this._onJoin.bind(this);
45
         this._onRoomChange = this._onRoomChange.bind(this);
61
         this._onRoomChange = this._onRoomChange.bind(this);
62
+        this._updateRoomname = this._updateRoomname.bind(this);
63
+        this._animateRoomnameChanging = roomnameChanging.bind(this);
46
     }
64
     }
47
 
65
 
48
     /**
66
     /**
55
         this.setState({ room: nextProps.room });
73
         this.setState({ room: nextProps.room });
56
     }
74
     }
57
 
75
 
76
+    /**
77
+    * This method is executed when method will be unmounted from DOM.
78
+    *
79
+    * @inheritdoc
80
+    */
81
+    componentWillUnmount() {
82
+        this._clearTimeouts();
83
+    }
84
+
85
+    /**
86
+    * Method that clears timeouts for animations and updates of room name.
87
+    *
88
+    * @private
89
+    * @returns {void}
90
+    */
91
+    _clearTimeouts() {
92
+        clearTimeout(this.state.animateTimeoutId);
93
+        clearTimeout(this.state.updateTimeoutId);
94
+    }
95
+
58
     /**
96
     /**
59
      * Determines whether the 'Join' button is (to be) disabled i.e. there's no
97
      * Determines whether the 'Join' button is (to be) disabled i.e. there's no
60
      * valid room name typed into the respective text input field.
98
      * valid room name typed into the respective text input field.
68
     }
106
     }
69
 
107
 
70
     /**
108
     /**
71
-     * Handles click on 'Join' button.
109
+     * Method triggering generation of new room name and
110
+     * initiating animation of its changing.
111
+     *
112
+     * @protected
113
+     * @returns {void}
114
+     */
115
+    _updateRoomname() {
116
+        const generatedRoomname = generateRoomWithoutSeparator();
117
+        const roomPlaceholder = '';
118
+        const updateTimeoutId = setTimeout(this._updateRoomname, 10000);
119
+
120
+        this._clearTimeouts();
121
+        this.setState({
122
+            updateTimeoutId,
123
+            generatedRoomname,
124
+            roomPlaceholder
125
+        }, () => this._animateRoomnameChanging(generatedRoomname));
126
+    }
127
+
128
+    /**
129
+     * Method animating changing room name.
130
+     *
131
+     * @param {string} word - The part of room name that should
132
+     * be added to placeholder.
133
+     * @private
134
+     * @returns {void}
135
+     */
136
+    _animateRoomnameChanging(word) {
137
+        const roomPlaceholder = this.state.roomPlaceholder + word.substr(0, 1);
138
+        let animateTimeoutId = null;
139
+
140
+        if (word.length > 1) {
141
+            animateTimeoutId = setTimeout(() => {
142
+                this._animateRoomnameChanging(word.substring(1, word.length));
143
+            }, 70);
144
+        }
145
+
146
+        this.setState({
147
+            animateTimeoutId,
148
+            roomPlaceholder
149
+        });
150
+    }
151
+
152
+    /**
153
+     * Handles joining. Either by clicking on 'Join' button
154
+     * or by pressing 'Enter' in room name input field.
72
      *
155
      *
73
      * @protected
156
      * @protected
74
      * @returns {void}
157
      * @returns {void}
75
      */
158
      */
76
-    _onJoinClick() {
77
-        this.props.dispatch(appNavigate(this.state.room));
159
+    _onJoin() {
160
+        const { room, generatedRoomname } = this.state;
161
+
162
+        if (room && room.length) {
163
+            this.props.dispatch(appNavigate(room));
164
+        } else {
165
+            this.props.dispatch(appNavigate(generatedRoomname));
166
+        }
78
     }
167
     }
79
 
168
 
80
     /**
169
     /**

+ 1
- 1
react/features/welcome/components/WelcomePage.native.js 查看文件

107
                         value = { this.state.room } />
107
                         value = { this.state.room } />
108
                     <TouchableHighlight
108
                     <TouchableHighlight
109
                         disabled = { this._isJoinDisabled() }
109
                         disabled = { this._isJoinDisabled() }
110
-                        onPress = { this._onJoinClick }
110
+                        onPress = { this._onJoin }
111
                         style = { styles.button }
111
                         style = { styles.button }
112
                         underlayColor = { ColorPalette.white }>
112
                         underlayColor = { ColorPalette.white }>
113
                         <Text style = { styles.buttonText }>JOIN</Text>
113
                         <Text style = { styles.buttonText }>JOIN</Text>

+ 249
- 22
react/features/welcome/components/WelcomePage.web.js 查看文件

1
-import React, { Component } from 'react';
1
+/* global interfaceConfig, APP  */
2
+
3
+import React from 'react';
4
+import { connect } from 'react-redux';
5
+
6
+import {
7
+    AbstractWelcomePage,
8
+    mapStateToProps
9
+} from './AbstractWelcomePage';
10
+
11
+const RIGHT_WATERMARK_STYLES = {
12
+    backgroundImage: 'url(images/rightwatermark.png)'
13
+};
2
 
14
 
3
 import { Conference } from '../../conference';
15
 import { Conference } from '../../conference';
4
 
16
 
5
 /**
17
 /**
6
  * The web container rendering the welcome page.
18
  * The web container rendering the welcome page.
7
  */
19
  */
8
-export default class WelcomePage extends Component {
20
+class WelcomePage extends AbstractWelcomePage {
21
+
22
+    /**
23
+    * Constructor function of WelcomePage.
24
+    *
25
+    * @param {Object} props - Props to be set.
26
+    **/
27
+    constructor(props) {
28
+        super(props);
29
+        this._initState();
30
+
31
+        // Bind event handlers so they are only bound once for every instance.
32
+        const onToggleDisableWelcome = this._onToggleDisableWelcomePage;
33
+
34
+        this._onRoomChange = this._onRoomChange.bind(this);
35
+        this._onKeyDown = this._onKeyDown.bind(this);
36
+        this._setInput = this._setInput.bind(this);
37
+        this._onUpdateRoomname = this._onUpdateRoomname.bind(this);
38
+        this._onToggleDisableWelcomePage = onToggleDisableWelcome.bind(this);
39
+    }
40
+
41
+    /**
42
+    * Method that initializes state of the component.
43
+    *
44
+    * @returns {void}
45
+    **/
46
+    _initState() {
47
+        const showPoweredBy = interfaceConfig.SHOW_POWERED_BY;
48
+        const generateRoomnames
49
+            = interfaceConfig.GENERATE_ROOMNAMES_ON_WELCOME_PAGE;
50
+        const enableWelcomePage = true;
51
+        const showJitsiWatermark = interfaceConfig.SHOW_JITSI_WATERMARK;
52
+        const showBrandWatermark = interfaceConfig.SHOW_BRAND_WATERMARK;
53
+        let jitsiWatermarkLink = '';
54
+        let brandWatermarkLink = '';
55
+
56
+        if (showJitsiWatermark) {
57
+            jitsiWatermarkLink = interfaceConfig.JITSI_WATERMARK_LINK;
58
+        }
59
+
60
+        if (showBrandWatermark) {
61
+            brandWatermarkLink = interfaceConfig.BRAND_WATERMARK_LINK;
62
+        }
63
+
64
+        this.state = Object.assign({}, this.state, {
65
+            showPoweredBy,
66
+            generateRoomnames,
67
+            showJitsiWatermark,
68
+            showBrandWatermark,
69
+            jitsiWatermarkLink,
70
+            brandWatermarkLink,
71
+            enableWelcomePage
72
+        });
73
+    }
74
+
75
+    /**
76
+    * Returns the domain name.
77
+    *
78
+    * @private
79
+    * @returns {string} Domain name.
80
+    **/
81
+    _getDomain() {
82
+        return `${window.location.protocol}//${window.location.host}/`;
83
+    }
84
+
85
+    /**
86
+    * This method is executed when comonent is mounted.
87
+    *
88
+    * @inheritdoc
89
+    */
90
+    componentDidMount() {
91
+        if (this.state.generateRoomnames) {
92
+            this._updateRoomname();
93
+        }
94
+    }
95
+
96
+    /**
97
+    * Handles toggling disable welcome page checkbox
98
+    *
99
+    * @returns {void}
100
+    **/
101
+    _onToggleDisableWelcomePage() {
102
+        const shouldEnable = this.state.enableWelcomePage;
103
+
104
+        this.setState({
105
+            enableWelcomePage: !shouldEnable
106
+        }, () => {
107
+            APP.settings.setWelcomePageEnabled(this.state.enableWelcomePage);
108
+        });
109
+    }
9
 
110
 
10
     /**
111
     /**
11
      * Implements React's {@link Component#render()}.
112
      * Implements React's {@link Component#render()}.
35
         );
136
         );
36
     }
137
     }
37
 
138
 
139
+    /**
140
+    * Sets input element as property of class.
141
+    *
142
+    * @param {HTMLInputElement} input - input element to be set.
143
+    * @returns {void}
144
+    * @private
145
+    **/
146
+    _setInput(input) {
147
+        this.roomNameInput = input;
148
+    }
149
+
38
     /**
150
     /**
39
      * Renders a feature with a specific index.
151
      * Renders a feature with a specific index.
40
      *
152
      *
93
     _renderHeader() {
205
     _renderHeader() {
94
         return (
206
         return (
95
             <div id = 'welcome_page_header'>
207
             <div id = 'welcome_page_header'>
96
-                <a target = '_new'>
97
-                    <div className = 'watermark leftwatermark' />
98
-                </a>
99
-                <a target = '_new'>
100
-                    <div className = 'watermark rightwatermark' />
101
-                </a>
102
-                <a
103
-                    className = 'poweredby'
104
-                    href = 'http://jitsi.org'
105
-                    target = '_new'>
106
-                    <span data-i18n = 'poweredby' /> jitsi.org
107
-                </a>
208
+                { this._renderJitsiWatermark() }
209
+                { this._renderBrandWatermark() }
210
+                { this._renderPoweredBy() }
108
                 <div id = 'enter_room_container'>
211
                 <div id = 'enter_room_container'>
109
                     <div id = 'enter_room_form'>
212
                     <div id = 'enter_room_form'>
110
-                        <div id = 'domain_name' />
213
+                        <div className = 'domain-name' >
214
+                            { this._getDomain() }
215
+                        </div>
111
                         <div id = 'enter_room'>
216
                         <div id = 'enter_room'>
112
                             <input
217
                             <input
113
                                 autoFocus = { true }
218
                                 autoFocus = { true }
219
+                                className = 'enter-room__field'
220
+                                data-room-name =
221
+                                    { this.state.generatedRoomname }
114
                                 id = 'enter_room_field'
222
                                 id = 'enter_room_field'
115
-                                type = 'text' />
223
+                                onChange = { this._onRoomChange }
224
+                                onKeyDown = { this._onKeyDown }
225
+                                placeholder = { this.state.roomPlaceholder }
226
+                                ref = { this._setInput }
227
+                                type = 'text'
228
+                                value = { this.state.room } />
116
                             <div
229
                             <div
117
-                                className = 'icon-reload'
118
-                                id = 'reload_roomname' />
119
-                            <input
120
-                                data-i18n = '[value]welcomepage.go'
230
+                                className = 'icon-reload enter-room__reload'
231
+                                onClick = { this._onUpdateRoomname } />
232
+                            <button
233
+                                className = 'enter-room__button'
234
+                                data-i18n = 'welcomepage.go'
121
                                 id = 'enter_room_button'
235
                                 id = 'enter_room_button'
122
-                                type = 'button'
123
-                                value = 'GO' />
236
+                                onClick = { this._onJoin }
237
+                                type = 'button' />
124
                         </div>
238
                         </div>
125
                     </div>
239
                     </div>
126
                 </div>
240
                 </div>
127
                 <div id = 'brand_header' />
241
                 <div id = 'brand_header' />
128
                 <input
242
                 <input
243
+                    checked = { !this.state.enableWelcomePage }
129
                     id = 'disable_welcome'
244
                     id = 'disable_welcome'
130
                     name = 'checkbox'
245
                     name = 'checkbox'
246
+                    onChange = { this._onToggleDisableWelcomePage }
131
                     type = 'checkbox' />
247
                     type = 'checkbox' />
132
                 <label
248
                 <label
133
                     className = 'disable_welcome_position'
249
                     className = 'disable_welcome_position'
138
         );
254
         );
139
     }
255
     }
140
 
256
 
257
+    /**
258
+    * Method that returns brand watermark element if it is enabled.
259
+    *
260
+    * @returns {ReactElement|null} Watermark element or null.
261
+    **/
262
+    _renderBrandWatermark() {
263
+        if (this.state.showBrandWatermark) {
264
+            return (
265
+                <a
266
+                    href = { this.state.brandWatermarkLink }
267
+                    target = '_new'>
268
+                    <div
269
+                        className = 'watermark rightwatermark'
270
+                        style = { RIGHT_WATERMARK_STYLES } />
271
+                </a>
272
+            );
273
+        }
274
+
275
+        return null;
276
+    }
277
+
278
+    /**
279
+    * Method that returns jitsi watermark element if it is enabled.
280
+    *
281
+    * @returns {ReactElement|null} Watermark element or null.
282
+    **/
283
+    _renderJitsiWatermark() {
284
+        if (this.state.showJitsiWatermark) {
285
+            return (
286
+                <a
287
+                    href = { this.state.jitsiWatermarkLink }
288
+                    target = '_new'>
289
+                    <div className = 'watermark leftwatermark' />
290
+                </a>
291
+            );
292
+        }
293
+
294
+        return null;
295
+    }
296
+
297
+    /**
298
+    * Renders powered by block if it is enabled
299
+    *
300
+    * @returns {void}
301
+    * @private
302
+    **/
303
+    _renderPoweredBy() {
304
+        if (this.state.showPoweredBy) {
305
+            return (
306
+                <a
307
+                    className = 'poweredby'
308
+                    href = 'http://jitsi.org'
309
+                    target = '_new'>
310
+                    <span data-i18n = 'poweredby' /> jitsi.org
311
+                </a>
312
+            );
313
+        }
314
+
315
+        return null;
316
+    }
317
+
318
+    /**
319
+    * Handles updating roomname.
320
+    *
321
+    * @private
322
+    * @returns {void}
323
+    **/
324
+    _onUpdateRoomname() {
325
+        this._updateRoomname();
326
+    }
327
+
328
+    /**
329
+    * Event handler for changing room name input from web.
330
+    *
331
+    * @inheritdoc
332
+    * @override
333
+    * @protected
334
+    */
335
+    _onRoomChange() {
336
+        super._onRoomChange(this.roomNameInput.value);
337
+    }
338
+
339
+    /**
340
+    * Handles 'keydown' event and initiate joining the room if 'return' button
341
+    * was pressed.
342
+    *
343
+    * @param {Event} event - Key down event object.
344
+    * @returns {void}
345
+    * @private
346
+    */
347
+    _onKeyDown(event) {
348
+        const RETURN_BUTTON_CODE = 13;
349
+
350
+        if (event.keyCode === RETURN_BUTTON_CODE) {
351
+            this._onJoin();
352
+        }
353
+    }
354
+
355
+    /**
356
+    * We override this method for web app for not dispatching 'set room' action.
357
+    *
358
+    * @returns {null}
359
+    * @override
360
+    * @protected
361
+    **/
362
+    _onJoin() {
363
+        return null;
364
+    }
365
+
141
     /**
366
     /**
142
      * Renders the main part of this WelcomePage.
367
      * Renders the main part of this WelcomePage.
143
      *
368
      *
159
         );
384
         );
160
     }
385
     }
161
 }
386
 }
387
+
388
+export default connect(mapStateToProps)(WelcomePage);

Loading…
取消
儲存