Browse Source

Toolbar notice as React Component

master
Ilya Daynatovich 8 years ago
parent
commit
59a74153dc

+ 8
- 7
css/_notice.scss View File

1
-#notice {
1
+.notice {
2
     position: relative;
2
     position: relative;
3
     z-index: 3;
3
     z-index: 3;
4
     margin-top: 6px;
4
     margin-top: 6px;
5
+
6
+    &__message {
7
+        background-color: #000000;
8
+        color: white;
9
+        padding: 3px;
10
+        border-radius: 5px;
11
+    }
5
 }
12
 }
6
-#noticeText {
7
-    background-color: #000000;
8
-    color: white;
9
-    padding: 3px;
10
-    border-radius: 5px;
11
-}

+ 0
- 6
modules/UI/UI.js View File

315
         // Initialise the recording module.
315
         // Initialise the recording module.
316
         if (config.enableRecording)
316
         if (config.enableRecording)
317
             Recording.init(eventEmitter, config.recordingType);
317
             Recording.init(eventEmitter, config.recordingType);
318
-
319
-        // Display notice message at the top of the toolbar
320
-        if (config.noticeMessage) {
321
-            $('#noticeText').text(config.noticeMessage);
322
-            UIUtil.setVisible('notice', true);
323
-        }
324
     } else {
318
     } else {
325
         $("body").addClass("filmstrip-only");
319
         $("body").addClass("filmstrip-only");
326
         UIUtil.setVisible('mainToolbarContainer', false);
320
         UIUtil.setVisible('mainToolbarContainer', false);

+ 3
- 20
react/features/conference/components/Conference.web.js View File

8
 import { Watermarks } from '../../base/react';
8
 import { Watermarks } from '../../base/react';
9
 import { FeedbackButton } from '../../feedback';
9
 import { FeedbackButton } from '../../feedback';
10
 import { OverlayContainer } from '../../overlay';
10
 import { OverlayContainer } from '../../overlay';
11
+import { Notice } from '../../toolbar';
11
 import { HideNotificationBarStyle } from '../../unsupported-browser';
12
 import { HideNotificationBarStyle } from '../../unsupported-browser';
12
 
13
 
13
 declare var $: Function;
14
 declare var $: Function;
14
 declare var APP: Object;
15
 declare var APP: Object;
15
 
16
 
16
-/**
17
- * For legacy reasons, inline style for display none.
18
- *
19
- * @private
20
- * @type {{
21
- *     display: string
22
- * }}
23
- */
24
-const _DISPLAY_NONE_STYLE = {
25
-    display: 'none'
26
-};
27
-
28
 /**
17
 /**
29
  * The conference page of the Web application.
18
  * The conference page of the Web application.
30
  */
19
  */
78
         return (
67
         return (
79
             <div id = 'videoconference_page'>
68
             <div id = 'videoconference_page'>
80
                 <div id = 'mainToolbarContainer'>
69
                 <div id = 'mainToolbarContainer'>
81
-                    <div
82
-                        className = 'notice'
83
-                        id = 'notice'
84
-                        style = { _DISPLAY_NONE_STYLE }>
85
-                        <span
86
-                            className = 'noticeText'
87
-                            id = 'noticeText' />
88
-                    </div>
70
+                    <Notice />
71
+
89
                     <div
72
                     <div
90
                         className = 'toolbar'
73
                         className = 'toolbar'
91
                         id = 'mainToolbar' />
74
                         id = 'mainToolbar' />

+ 52
- 0
react/features/toolbar/components/Notice.js View File

1
+/* @flow */
2
+
3
+import React, { Component } from 'react';
4
+
5
+declare var config: Object;
6
+
7
+/**
8
+ * Notice react component.
9
+ *
10
+ * @class Notice
11
+ */
12
+export default class Notice extends Component {
13
+    state: Object;
14
+
15
+    /**
16
+     * Constructor of Notice component.
17
+     *
18
+     * @param {Object} props - The read-only React Component props with which
19
+     * the new instance is to be initialized.
20
+     */
21
+    constructor(props: Object) {
22
+        super(props);
23
+
24
+        const { noticeMessage } = config;
25
+
26
+        this.state = {
27
+            noticeMessage
28
+        };
29
+    }
30
+
31
+    /**
32
+     * Implements React's {@link Component#render()}.
33
+     *
34
+     * @inheritdoc
35
+     * @returns {ReactElement}
36
+     */
37
+    render() {
38
+        const { noticeMessage } = this.state;
39
+
40
+        if (!noticeMessage) {
41
+            return null;
42
+        }
43
+
44
+        return (
45
+            <div className = 'notice'>
46
+                <span className = 'notice__message' >
47
+                    { noticeMessage }
48
+                </span>
49
+            </div>
50
+        );
51
+    }
52
+}

+ 0
- 0
react/features/toolbar/components/Toolbar.web.js View File


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

1
+export { default as Notice } from './Notice';
1
 export { default as Toolbar } from './Toolbar';
2
 export { default as Toolbar } from './Toolbar';

Loading…
Cancel
Save