浏览代码

Comply w/ coding style

j8
Lyubomir Marinov 8 年前
父节点
当前提交
cbcee201f0

+ 1
- 1
css/_variables.scss 查看文件

@@ -131,6 +131,6 @@ $linkHoverFontColor: #287ade;
131 131
 /**
132 132
  * Landing
133 133
  */
134
+$primaryUnsupportedBrowserButtonBgColor: #17a0db;
134 135
 $unsupportedBrowserButtonBgColor: #ff9a00;
135 136
 $unsupportedBrowserTextColor: #4a4a4a;
136
-$primaryUnsupportedBrowserButtonBgColor: #17a0db;

+ 2
- 2
css/main.scss 查看文件

@@ -67,7 +67,7 @@
67 67
 @import '404';
68 68
 @import 'policy';
69 69
 @import 'filmstrip';
70
-@import 'unsupported-browser/mobile-browser-page';
71
-@import 'unsupported-browser/unsupported_browser';
70
+@import 'unsupported-browser/unsupported-desktop-browser';
71
+@import 'unsupported-browser/unsupported-mobile-browser';
72 72
 
73 73
 /* Modules END */

css/unsupported-browser/_unsupported_browser.scss → css/unsupported-browser/_unsupported-desktop-browser.scss 查看文件

@@ -1,10 +1,10 @@
1
-.browser {
1
+.supported-browser {
2
+    color: #929391;
2 3
     display: inline-block;
4
+    font-size: 20px;
3 5
     margin: 1em 7px;
4
-    width: 138px;
5 6
     vertical-align: middle;
6
-    color: #929391;
7
-    font-size: 20px;
7
+    width: 138px;
8 8
 
9 9
     &__button {
10 10
         background-color: #62c82a;
@@ -12,11 +12,11 @@
12 12
         border-radius: 10px;
13 13
         color: #FFFFFF;
14 14
         font-size: 12px;
15
-        text-align: center;
16
-        width: 115px;
17 15
         height: 26px;
18
-        padding-top: 13px;
19 16
         margin: 15px auto 0px auto;
17
+        padding-top: 13px;
18
+        text-align: center;
19
+        width: 115px;
20 20
     }
21 21
 
22 22
     &__link {
@@ -45,39 +45,39 @@
45 45
         margin: 20px auto 0px auto;
46 46
 
47 47
         &_chrome {
48
-            width: 78px;
49
-            height: 78px;
50 48
             background-image: url('../../images/chrome.png');
49
+            height: 78px;
50
+            width: 78px;
51 51
         }
52 52
 
53 53
         &_chromium {
54
-            width: 77px;
55
-            height: 78px;
56 54
             background-image: url('../../images/chromium.png');
55
+            height: 78px;
56
+            width: 77px;
57 57
         }
58 58
 
59 59
         &_firefox {
60
-            width: 86px;
61
-            height: 80px;
62 60
             background-image: url('../../images/firefox.png');
61
+            height: 80px;
62
+            width: 86px;
63 63
         }
64 64
 
65 65
         &_opera {
66
-            width: 73px;
67
-            height: 78px;
68 66
             background-image: url('../../images/opera.png');
67
+            height: 78px;
68
+            width: 73px;
69 69
         }
70 70
 
71 71
         &_ie {
72
-            width: 80px;
73
-            height: 78px;
74 72
             background-image: url('../../images/ie.png');
73
+            height: 78px;
74
+            width: 80px;
75 75
         }
76 76
 
77 77
         &_safari {
78
-            width: 78px;
79
-            height: 79px;
80 78
             background-image: url('../../images/safari.png');
79
+            height: 79px;
80
+            width: 78px;
81 81
         }
82 82
     }
83 83
 
@@ -91,30 +91,30 @@
91 91
     }
92 92
 
93 93
     &__tile {
94
-        width: 138px;
95
-        height: 163px;
96
-        margin-top: 5px;
97 94
         background-color: #e8e8e8;
98 95
         border: 1px solid #cfcfcf;
99 96
         border-radius: 10px;
97
+        height: 163px;
98
+        margin-top: 5px;
99
+        width: 138px;
100 100
     }
101 101
 }
102 102
 
103
-.unsupported-browser {
103
+.unsupported-desktop-browser {
104 104
     display: block;
105
-    position: absolute;
106
-    width:500px;
107 105
     height: 565px;
106
+    margin: auto;
108 107
     overflow:hidden;
108
+    position: absolute;
109 109
     text-align: center;
110
-    margin: auto;
111 110
     top: 0; left: 0; bottom: 0; right: 0;
111
+    width:500px;
112 112
 
113 113
     &__page {
114 114
         display:inline-block;
115 115
         font-size: 28px;
116
-        vertical-align:middle;
117 116
         padding-top: 25px;
117
+        vertical-align:middle;
118 118
     }
119 119
 
120 120
     &__title {
@@ -123,10 +123,10 @@
123 123
     }
124 124
 
125 125
     &-wrapper {
126
+        background: #fff;
126 127
         display: block;
128
+        height: 100%;
127 129
         position: absolute;
128 130
         width: 100%;
129
-        height: 100%;
130
-        background: #fff;
131 131
     }
132 132
 }

css/unsupported-browser/_mobile-browser-page.scss → css/unsupported-browser/_unsupported-mobile-browser.scss 查看文件

@@ -1,4 +1,4 @@
1
-.mobile-browser-page {
1
+.unsupported-mobile-browser {
2 2
     background-color: #fff;
3 3
     height: 100vh;
4 4
     padding: 35px 0;
@@ -22,9 +22,9 @@
22 22
         margin-bottom: 0.65em;
23 23
 
24 24
         &_small {
25
+            font-size: 1.5em;
25 26
             margin-bottom: 1em;
26 27
             margin-top: em(21, 18);
27
-            font-size: 1.5em;
28 28
 
29 29
             strong {
30 30
                 font-size: em(21, 18);

+ 33
- 21
react/features/app/actions.js 查看文件

@@ -42,13 +42,7 @@ export function appNavigate(urlOrRoom) {
42 42
         // domain.
43 43
 
44 44
         if (typeof domain === 'undefined' || oldDomain === domain) {
45
-            // If both domain and room vars became undefined, that means we're
46
-            // actually dealing with just room name and not with URL.
47
-            dispatch(
48
-                _setRoomAndNavigate(
49
-                    typeof room === 'undefined' && typeof domain === 'undefined'
50
-                        ? urlOrRoom
51
-                        : room));
45
+            dispatchSetRoomAndNavigate();
52 46
         } else if (oldDomain !== domain) {
53 47
             // Update domain without waiting for config to be loaded to prevent
54 48
             // race conditions when we will start to load config multiple times.
@@ -61,14 +55,7 @@ export function appNavigate(urlOrRoom) {
61 55
                 .then(
62 56
                     config => configLoaded(/* err */ undefined, config),
63 57
                     err => configLoaded(err, /* config */ undefined))
64
-                .then(() => {
65
-                    const link = typeof room === 'undefined'
66
-                    && typeof domain === 'undefined'
67
-                    ? urlOrRoom
68
-                    : room;
69
-
70
-                    dispatch(_setRoomAndNavigate(link));
71
-                });
58
+                .then(dispatchSetRoomAndNavigate);
72 59
         }
73 60
 
74 61
         /**
@@ -94,6 +81,21 @@ export function appNavigate(urlOrRoom) {
94 81
 
95 82
             dispatch(setConfig(config));
96 83
         }
84
+
85
+        /**
86
+         * Dispatches _setRoomAndNavigate in the Redux store.
87
+         *
88
+         * @returns {void}
89
+         */
90
+        function dispatchSetRoomAndNavigate() {
91
+            // If both domain and room vars became undefined, that means we're
92
+            // actually dealing with just room name and not with URL.
93
+            dispatch(
94
+                _setRoomAndNavigate(
95
+                    typeof room === 'undefined' && typeof domain === 'undefined'
96
+                        ? urlOrRoom
97
+                        : room));
98
+        }
97 99
     };
98 100
 }
99 101
 
@@ -129,6 +131,21 @@ export function appWillUnmount(app) {
129 131
     };
130 132
 }
131 133
 
134
+/**
135
+ * Navigates to a route in accord with a specific Redux state.
136
+ *
137
+ * @param {Object} state - The Redux state which determines/identifies the route
138
+ * to navigate to.
139
+ * @private
140
+ * @returns {void}
141
+ */
142
+function _navigate(state) {
143
+    const app = state['features/app'].app;
144
+    const routeToRender = _getRouteToRender(state);
145
+
146
+    app._navigate(routeToRender);
147
+}
148
+
132 149
 /**
133 150
  * Sets room and navigates to new route if needed.
134 151
  *
@@ -139,11 +156,6 @@ export function appWillUnmount(app) {
139 156
 function _setRoomAndNavigate(newRoom) {
140 157
     return (dispatch, getState) => {
141 158
         dispatch(setRoom(newRoom));
142
-
143
-        const state = getState();
144
-        const { app } = state['features/app'];
145
-        const newRoute = _getRouteToRender(state);
146
-
147
-        app._navigate(newRoute);
159
+        _navigate(getState());
148 160
     };
149 161
 }

+ 32
- 33
react/features/app/components/AbstractApp.js 查看文件

@@ -1,11 +1,11 @@
1 1
 import React, { Component } from 'react';
2 2
 import { Provider } from 'react-redux';
3 3
 
4
+import { RouteRegistry } from '../../base/navigator';
4 5
 import {
5 6
     localParticipantJoined,
6 7
     localParticipantLeft
7 8
 } from '../../base/participants';
8
-import { RouteRegistry } from '../../base/navigator';
9 9
 
10 10
 import {
11 11
     appNavigate,
@@ -32,7 +32,7 @@ export class AbstractApp extends Component {
32 32
          * The URL, if any, with which the app was launched.
33 33
          */
34 34
         url: React.PropTypes.string
35
-    };
35
+    }
36 36
 
37 37
     /**
38 38
      * Initializes a new App instance.
@@ -211,38 +211,37 @@ export class AbstractApp extends Component {
211 211
      * @returns {void}
212 212
      */
213 213
     _navigate(route) {
214
-        const currentRoute = this.state.route || {};
215
-
216
-        if (!RouteRegistry.areRoutesEqual(route, currentRoute)) {
217
-            let nextState = {
218
-                ...this.state,
219
-                route
220
-            };
221
-
222
-            // The Web App was using react-router so it utilized react-router's
223
-            // onEnter. During the removal of react-router, modifications were
224
-            // minimized by preserving the onEnter interface:
225
-            // (1) Router would provide its nextState to the Route's onEnter.
226
-            // As the role of Router is now this AbstractApp, provide its
227
-            // nextState.
228
-            // (2) A replace function would be provided to the Route in case it
229
-            // chose to redirect to another path.
230
-            this._onRouteEnter(route, nextState, pathname => {
231
-                // FIXME In order to minimize the modifications related to the
232
-                // removal of react-router, the Web implementation is provided
233
-                // bellow because the replace function is used on Web only at
234
-                // the time of this writing. Provide a platform-agnostic
235
-                // implementation. It should likely find the best Route matching
236
-                // the specified pathname and navigate to it.
237
-                window.location.pathname = pathname;
238
-
239
-                // Do not proceed with the route because it chose to redirect to
240
-                // another path.
241
-                nextState = undefined;
242
-            });
243
-
244
-            nextState && this.setState(nextState);
214
+        if (RouteRegistry.areRoutesEqual(this.state.route, route)) {
215
+            return;
245 216
         }
217
+
218
+        let nextState = {
219
+            ...this.state,
220
+            route
221
+        };
222
+
223
+        // The Web App was using react-router so it utilized react-router's
224
+        // onEnter. During the removal of react-router, modifications were
225
+        // minimized by preserving the onEnter interface:
226
+        // (1) Router would provide its nextState to the Route's onEnter. As the
227
+        // role of Router is now this AbstractApp, provide its nextState.
228
+        // (2) A replace function would be provided to the Route in case it
229
+        // chose to redirect to another path.
230
+        this._onRouteEnter(route, nextState, pathname => {
231
+            // FIXME In order to minimize the modifications related to the
232
+            // removal of react-router, the Web implementation is provided
233
+            // bellow because the replace function is used on Web only at the
234
+            // time of this writing. Provide a platform-agnostic implementation.
235
+            // It should likely find the best Route matching the specified
236
+            // pathname and navigate to it.
237
+            window.location.pathname = pathname;
238
+
239
+            // Do not proceed with the route because it chose to redirect to
240
+            // another path.
241
+            nextState = undefined;
242
+        });
243
+
244
+        nextState && this.setState(nextState);
246 245
     }
247 246
 
248 247
     /**

+ 25
- 14
react/features/base/navigator/RouteRegistry.js 查看文件

@@ -11,20 +11,6 @@
11 11
  * without needing to create additional inter-feature dependencies.
12 12
  */
13 13
 class RouteRegistry {
14
-    /**
15
-     * Method checking whether route objects are equal by value. Returns true if
16
-     * and only if key values of the first object are equal to key values of
17
-     * the second one.
18
-     *
19
-     * @param {Object} newRoute - New route object to be compared.
20
-     * @param {Object} oldRoute - Old route object to be compared.
21
-     * @returns {boolean}
22
-     */
23
-    areRoutesEqual(newRoute, oldRoute) {
24
-        return Object.keys(newRoute)
25
-            .every(key => newRoute[key] === oldRoute[key]);
26
-    }
27
-
28 14
     /**
29 15
      * Initializes a new RouteRegistry instance.
30 16
      */
@@ -37,6 +23,31 @@ class RouteRegistry {
37 23
         this._routeRegistry = new Set();
38 24
     }
39 25
 
26
+    /**
27
+     * Determines whether two specific Routes are equal i.e. they describe one
28
+     * and the same abstract route.
29
+     *
30
+     * @param {Object} a - The Route to compare to b.
31
+     * @param {Object} b - The Route to compare to a.
32
+     * @returns {boolean} True if the specified a and b describe one and the
33
+     * same abstract route; otherwise, false.
34
+     */
35
+    areRoutesEqual(a, b) {
36
+        if (a === b) { // reflexive
37
+            return true;
38
+        }
39
+        if (!a) {
40
+            return !b;
41
+        }
42
+        if (!b) {
43
+            return !a;
44
+        }
45
+
46
+        return (
47
+            Object.keys(a).every(key => a[key] === b[key])
48
+                && /* symmetric */ this.areRoutesEqual(b, a));
49
+    }
50
+
40 51
     /**
41 52
      * Returns all registered routes.
42 53
      *

+ 1
- 1
react/features/base/util/index.js 查看文件

@@ -1,3 +1,3 @@
1
+export * from './interceptComponent';
1 2
 export * from './loadScript';
2 3
 export * from './roomnameGenerator';
3
-export * from './componentInterceptor';

react/features/base/util/componentInterceptor.js → react/features/base/util/interceptComponent.js 查看文件

@@ -1,8 +1,5 @@
1 1
 import { Platform } from '../react';
2
-
3
-import {
4
-    MobileBrowserPage
5
-} from '../../unsupported-browser';
2
+import { UnsupportedMobileBrowser } from '../../unsupported-browser';
6 3
 
7 4
 /**
8 5
  * Array of rules defining whether we should intercept component to render
@@ -21,16 +18,16 @@ const RULES = [
21 18
      * WebRTC support on Android).
22 19
      *
23 20
      * @param {Object} state - Object containing Redux state.
24
-     * @returns {MobileBrowserPage|void} If the rule is satisfied then
25
-     * we should intercept existing component by MobileBrowserPage.
21
+     * @returns {UnsupportedMobileBrowser|void} If the rule is satisfied then
22
+     * we should intercept existing component by UnsupportedMobileBrowser.
26 23
      */
27 24
     state => {
28 25
         const OS = Platform.OS;
29 26
         const { mobileBrowserPageIsShown }
30
-        = state['features/unsupported-browser'];
27
+            = state['features/unsupported-browser'];
31 28
 
32 29
         if ((OS === 'android' || OS === 'ios') && !mobileBrowserPageIsShown) {
33
-            return MobileBrowserPage;
30
+            return UnsupportedMobileBrowser;
34 31
         }
35 32
     }
36 33
 ];
@@ -49,12 +46,11 @@ export function interceptComponent(stateOrGetState, currentComponent) {
49 46
     let result;
50 47
     const state
51 48
         = typeof stateOrGetState === 'function'
52
-        ? stateOrGetState()
53
-        : stateOrGetState;
49
+            ? stateOrGetState()
50
+            : stateOrGetState;
54 51
 
55 52
     for (const rule of RULES) {
56 53
         result = rule(state);
57
-
58 54
         if (result) {
59 55
             break;
60 56
         }

+ 0
- 119
react/features/unsupported-browser/components/UnsupportedBrowserPage.js 查看文件

@@ -1,119 +0,0 @@
1
-import React, { Component } from 'react';
2
-
3
-/**
4
- * Array of all supported browsers.
5
- */
6
-const SUPPORTED_BROWSERS = [
7
-    {
8
-        link: 'http://google.com/chrome',
9
-        name: 'chrome',
10
-        plugin: false,
11
-        title: 'Chrome 44+'
12
-    }, {
13
-        link: 'http://www.chromium.org/',
14
-        name: 'chromium',
15
-        plugin: false,
16
-        title: 'Chromium 44+'
17
-    }, {
18
-        link: 'http://www.opera.com',
19
-        name: 'opera',
20
-        plugin: false,
21
-        title: 'Opera 32+'
22
-    }, {
23
-        link: 'http://www.getfirefox.com/',
24
-        name: 'firefox',
25
-        plugin: false,
26
-        title: 'Firefox and Iceweasel 40+'
27
-    }, {
28
-        link: 'https://temasys.atlassian.net/wiki/display/TWPP/WebRTC+Plugins',
29
-        name: 'ie',
30
-        plugin: 'Temasys 0.8.854+',
31
-        title: 'IE'
32
-    }, {
33
-        link: 'https://temasys.atlassian.net/wiki/display/TWPP/WebRTC+Plugins',
34
-        name: 'safari',
35
-        plugin: 'Temasys 0.8.854+',
36
-        title: 'Safari'
37
-    }
38
-];
39
-
40
-/**
41
- * React component representing unsupported browser page.
42
- *
43
- * @class UnsupportedBrowserPage
44
- */
45
-export default class UnsupportedBrowserPage extends Component {
46
-    /**
47
-     * Renders the component.
48
-     *
49
-     * @returns {ReactElement}
50
-     */
51
-    render() {
52
-        return (
53
-            <div className = 'unsupported-browser-wrapper'>
54
-                <div className = 'unsupported-browser'>
55
-                    <div className = 'unsupported-browser__content'>
56
-                        <h2 className = 'unsupported-browser__title'>
57
-                            This application is currently only supported by
58
-                        </h2>
59
-                        { this._getSupportedBrowsersLayout() }
60
-                    </div>
61
-                </div>
62
-            </div>
63
-        );
64
-    }
65
-
66
-    /**
67
-     * Generates layout for the list of supported browsers.
68
-     *
69
-     * @returns {ReactElement}
70
-     * @private
71
-     */
72
-    _getSupportedBrowsersLayout() {
73
-        return (
74
-            <div className = 'browser-list'>
75
-                { SUPPORTED_BROWSERS.map(this._getSupportedBrowser) }
76
-            </div>
77
-        );
78
-    }
79
-
80
-    /**
81
-     * Method that generated layout for supported browser object.
82
-     *
83
-     * @param {Object} browser - Object containing information about supported
84
-     * browser.
85
-     * @returns {ReactElement}
86
-     * @private
87
-     */
88
-    _getSupportedBrowser(browser) {
89
-        let pluginHtml = null;
90
-        const logoClassName = `browser__logo browser__logo_${browser.name}`;
91
-
92
-        // Browsers not supporting WebRTC could support application
93
-        // with Temasys plugin installed.
94
-        if (browser.plugin) {
95
-            const className = 'browser__text_small';
96
-
97
-            pluginHtml = <p className = { className }>({ browser.plugin })</p>;
98
-        }
99
-
100
-        return (
101
-            <div
102
-                className = 'browser'
103
-                key = { browser.name }>
104
-                <div className = 'browser__text'>
105
-                    { browser.title }
106
-                    { pluginHtml }
107
-                </div>
108
-                <div className = 'browser__tile'>
109
-                    <div className = { logoClassName } />
110
-                    <a
111
-                        className = 'browser__link'
112
-                        href = { browser.link }>
113
-                        <div className = 'browser__button'>DOWNLOAD</div>
114
-                    </a>
115
-                </div>
116
-            </div>
117
-        );
118
-    }
119
-}

+ 125
- 0
react/features/unsupported-browser/components/UnsupportedDesktopBrowser.js 查看文件

@@ -0,0 +1,125 @@
1
+import React, { Component } from 'react';
2
+
3
+/**
4
+ * The list of all browsers supported by the application.
5
+ */
6
+const SUPPORTED_BROWSERS = [
7
+    {
8
+        link: 'http://google.com/chrome',
9
+        name: 'chrome',
10
+        title: 'Chrome 44+'
11
+    }, {
12
+        link: 'http://www.chromium.org/',
13
+        name: 'chromium',
14
+        title: 'Chromium 44+'
15
+    }, {
16
+        link: 'http://www.getfirefox.com/',
17
+        name: 'firefox',
18
+        title: 'Firefox and Iceweasel 40+'
19
+    }, {
20
+        link: 'http://www.opera.com',
21
+        name: 'opera',
22
+        title: 'Opera 32+'
23
+    }, {
24
+        link: 'https://temasys.atlassian.net/wiki/display/TWPP/WebRTC+Plugins',
25
+        name: 'ie',
26
+        plugin: 'Temasys 0.8.854+',
27
+        title: 'IE'
28
+    }, {
29
+        link: 'https://temasys.atlassian.net/wiki/display/TWPP/WebRTC+Plugins',
30
+        name: 'safari',
31
+        plugin: 'Temasys 0.8.854+',
32
+        title: 'Safari'
33
+    }
34
+];
35
+
36
+/**
37
+ * React component representing unsupported browser page.
38
+ *
39
+ * @class UnsupportedDesktopBrowser
40
+ */
41
+export default class UnsupportedDesktopBrowser extends Component {
42
+    /**
43
+     * Renders the component.
44
+     *
45
+     * @returns {ReactElement}
46
+     */
47
+    render() {
48
+        const ns = 'unsupported-desktop-browser';
49
+
50
+        return (
51
+            <div className = { `${ns}-wrapper` }>
52
+                <div className = { ns }>
53
+                    <div className = { `${ns}__content` }>
54
+                        <h2 className = { `${ns}__title` }>
55
+                            This application is currently only supported by
56
+                        </h2>
57
+                        {
58
+                            this._renderSupportedBrowsers()
59
+                        }
60
+                    </div>
61
+                </div>
62
+            </div>
63
+        );
64
+    }
65
+
66
+    /**
67
+     * Renders a specific browser supported by the application.
68
+     *
69
+     * @param {Object} browser - The (information about the) browser supported
70
+     * by the application to render.
71
+     * @private
72
+     * @returns {ReactElement}
73
+     */
74
+    _renderSupportedBrowser(browser) {
75
+        const { link, name, plugin, title } = browser;
76
+        const ns = 'supported-browser';
77
+
78
+        // Browsers which do not support WebRTC could support the application
79
+        // with the Temasys plugin.
80
+        const pluginElement
81
+            = plugin
82
+                ? <p className = { `${ns}__text_small` }>{ plugin }</p>
83
+                : null;
84
+
85
+        return (
86
+            <div
87
+                className = { ns }
88
+                key = { name }>
89
+                <div className = { `${ns}__text` }>
90
+                    {
91
+                        title
92
+                    }
93
+                    {
94
+                        pluginElement
95
+                    }
96
+                </div>
97
+                <div className = { `${ns}__tile` }>
98
+                    <div
99
+                        className = { `${ns}__logo ${ns}__logo_${name}` } />
100
+                    <a
101
+                        className = { `${ns}__link` }
102
+                        href = { link }>
103
+                        <div className = { `${ns}__button` }>DOWNLOAD</div>
104
+                    </a>
105
+                </div>
106
+            </div>
107
+        );
108
+    }
109
+
110
+    /**
111
+     * Renders the list of browsers supported by the application.
112
+     *
113
+     * @private
114
+     * @returns {ReactElement}
115
+     */
116
+    _renderSupportedBrowsers() {
117
+        return (
118
+            <div className = 'supported-browser-list'>
119
+                {
120
+                    SUPPORTED_BROWSERS.map(this._renderSupportedBrowser)
121
+                }
122
+            </div>
123
+        );
124
+    }
125
+}

react/features/unsupported-browser/components/MobileBrowserPage.js → react/features/unsupported-browser/components/UnsupportedMobileBrowser.js 查看文件

@@ -1,9 +1,9 @@
1 1
 import React, { Component } from 'react';
2 2
 import { connect } from 'react-redux';
3 3
 
4
+import { appNavigate } from '../../app';
4 5
 import { Platform } from '../../base/react';
5 6
 
6
-import { appNavigate } from '../../app';
7 7
 import { mobileBrowserPageIsShown } from '../actions';
8 8
 
9 9
 /**
@@ -18,12 +18,21 @@ const URLS = {
18 18
 /**
19 19
  * React component representing mobile browser page.
20 20
  *
21
- * @class MobileBrowserPage
21
+ * @class UnsupportedMobileBrowser
22 22
  */
23
-class MobileBrowserPage extends Component {
23
+class UnsupportedMobileBrowser extends Component {
24
+    /**
25
+     * Mobile browser page component's property types.
26
+     *
27
+     * @static
28
+     */
29
+    static propTypes = {
30
+        dispatch: React.PropTypes.func,
31
+        room: React.PropTypes.string
32
+    }
24 33
 
25 34
     /**
26
-     * Constructor of MobileBrowserPage component.
35
+     * Constructor of UnsupportedMobileBrowser component.
27 36
      *
28 37
      * @param {Object} props - The read-only React Component props with which
29 38
      * the new instance is to be initialized.
@@ -35,16 +44,6 @@ class MobileBrowserPage extends Component {
35 44
         this._onClickJoin = this._onClickJoin.bind(this);
36 45
     }
37 46
 
38
-    /**
39
-     * Mobile browser page component's property types.
40
-     *
41
-     * @static
42
-     */
43
-    static propTypes = {
44
-        dispatch: React.PropTypes.func,
45
-        room: React.PropTypes.string
46
-    };
47
-
48 47
     /**
49 48
      * React lifecycle method triggered after component is mounted.
50 49
      *
@@ -62,13 +61,14 @@ class MobileBrowserPage extends Component {
62 61
     componentWillMount() {
63 62
         const { room } = this.props;
64 63
         let btnText;
65
-        let link = '';
64
+        let link;
66 65
 
67 66
         if (room) {
68 67
             btnText = 'Join the conversation';
69
-            link += room;
68
+            link = room;
70 69
         } else {
71 70
             btnText = 'Start a conference';
71
+            link = '';
72 72
         }
73 73
 
74 74
         this.setState({
@@ -77,38 +77,23 @@ class MobileBrowserPage extends Component {
77 77
         });
78 78
     }
79 79
 
80
-    /**
81
-     * Navigates to the next state of the app.
82
-     *
83
-     * @returns {void}
84
-     * @private
85
-     */
86
-    _onClickJoin() {
87
-        const { link } = this.state;
88
-
89
-        this.props.dispatch(appNavigate(link));
90
-    }
91
-
92 80
     /**
93 81
      * Renders component.
94 82
      *
95 83
      * @returns {ReactElement}
96 84
      */
97 85
     render() {
98
-        const { btnText } = this.state;
99
-        const blockPrefix = 'mobile-browser-page';
100
-        const textClasses = `${blockPrefix}__text ${blockPrefix}__text_small`;
101
-        let primaryButtonClasses = `${blockPrefix}__button`;
102
-
103
-        primaryButtonClasses += ` ${blockPrefix}__button_primary`;
86
+        const ns = 'unsupported-mobile-browser';
87
+        const primaryButtonClasses
88
+            = `${ns}__button ${ns}__button_primary`;
104 89
 
105 90
         return (
106
-            <div className = { blockPrefix }>
107
-                <div className = { `${blockPrefix}__body` }>
91
+            <div className = { ns }>
92
+                <div className = { `${ns}__body` }>
108 93
                     <img
109
-                        className = { `${blockPrefix}__logo` }
94
+                        className = { `${ns}__logo` }
110 95
                         src = '/images/logo-blue.svg' />
111
-                    <p className = { `${blockPrefix}__text` }>
96
+                    <p className = { `${ns}__text` }>
112 97
                         You need <strong>Jitsi Meet</strong> to join a
113 98
                         conversation on your mobile
114 99
                     </p>
@@ -117,24 +102,37 @@ class MobileBrowserPage extends Component {
117 102
                             Download the App
118 103
                         </button>
119 104
                     </a>
120
-                    <p className = { textClasses }>
105
+                    <p className = { `${ns}__text ${ns}__text_small` }>
121 106
                         or if you already have it
122 107
                         <br />
123 108
                         <strong>then</strong>
124 109
                     </p>
125 110
                     <button
126
-                        className = 'mobile-browser-page__button'
111
+                        className = { `${ns}__button` }
127 112
                         onClick = { this._onClickJoin }>
128
-                        { btnText }
113
+                        {
114
+                            this.state.btnText
115
+                        }
129 116
                     </button>
130 117
                 </div>
131 118
             </div>
132 119
         );
133 120
     }
121
+
122
+    /**
123
+     * Navigates to the next state of the app.
124
+     *
125
+     * @private
126
+     * @returns {void}
127
+     */
128
+    _onClickJoin() {
129
+        this.props.dispatch(appNavigate(this.state.link));
130
+    }
134 131
 }
135 132
 
136 133
 /**
137
- * Maps (parts of) the Redux state to the associated MobileBrowserPage's props.
134
+ * Maps (parts of) the Redux state to the associated UnsupportedMobileBrowser's
135
+ * props.
138 136
  *
139 137
  * @param {Object} state - Redux state.
140 138
  * @returns {{
@@ -147,4 +145,4 @@ function mapStateToProps(state) {
147 145
     };
148 146
 }
149 147
 
150
-export default connect(mapStateToProps)(MobileBrowserPage);
148
+export default connect(mapStateToProps)(UnsupportedMobileBrowser);

+ 4
- 2
react/features/unsupported-browser/components/index.js 查看文件

@@ -1,2 +1,4 @@
1
-export { default as MobileBrowserPage } from './MobileBrowserPage';
2
-export { default as UnsupportedBrowserPage } from './UnsupportedBrowserPage';
1
+export { default as UnsupportedDesktopBrowser }
2
+    from './UnsupportedDesktopBrowser';
3
+export { default as UnsupportedMobileBrowser }
4
+    from './UnsupportedMobileBrowser';

正在加载...
取消
保存