Selaa lähdekoodia

feat(small-video): use AtlasKit tooltip

efficient_tiling
Leonard Kim 7 vuotta sitten
vanhempi
commit
38e2443ab7

+ 1
- 2
css/_filmstrip.scss Näytä tiedosto

@@ -11,13 +11,13 @@
11 11
     right: 0;
12 12
     padding: 10px 5px;
13 13
     @extend %align-right;
14
+    z-index: $filmstripVideosZ;
14 15
 
15 16
     &__toolbar {
16 17
         @include flex();
17 18
         flex-direction: column-reverse;
18 19
         flex-wrap: nowrap;
19 20
         position: relative;
20
-        z-index: $zindex1; // Set z-index to make element visible.
21 21
         width: $filmstripToggleButtonWidth;
22 22
 
23 23
         button {
@@ -53,7 +53,6 @@
53 53
         /* The filmstrip should not be covered by the left toolbar. */
54 54
         bottom: 0;
55 55
         width:auto;
56
-        z-index: $filmstripVideosZ;
57 56
         transition: bottom 2s;
58 57
         overflow: visible !important;
59 58
         /*!!! Removes the gap between the local video container and the remote

+ 23
- 4
css/_vertical_filmstrip_overrides.scss Näytä tiedosto

@@ -112,7 +112,7 @@
112 112
             &__toolbar {
113 113
                 text-align: right;
114 114
 
115
-                .toolbar-icon {
115
+                .right {
116 116
                     float: none;
117 117
                     margin: auto;
118 118
                 }
@@ -193,9 +193,28 @@
193 193
      */
194 194
     .connection-indicator,
195 195
     .remote-video-menu-trigger,
196
-    .videocontainer__toolbar,
197
-    .raisehandindicator,
198
-    #dominantspeakerindicator {
196
+    .indicator-icon-container {
199 197
         transform: translate3d(0, 0, 0);
200 198
     }
199
+
200
+    .indicator-container {
201
+        float: none;
202
+    }
203
+
204
+    /**
205
+     * FIXME: disable pointer to allow any elements moved below to still be
206
+     * clickable. The real fix would to make sure those moved elements are
207
+     * actually part of the toolbar instead of positioning being faked.
208
+     */
209
+    .videocontainer__toolbar {
210
+        pointer-events: none;
211
+
212
+        > div {
213
+            pointer-events: none;
214
+        }
215
+
216
+        .toolbar-icon {
217
+            pointer-events: all;
218
+        }
219
+    }
201 220
 }

+ 42
- 17
css/_videolayout_default.scss Näytä tiedosto

@@ -41,9 +41,30 @@
41 41
     &__toptoolbar {
42 42
         position: absolute;
43 43
         left: 0;
44
-        z-index: $zindex3;
44
+        pointer-events: none;
45
+        z-index: $zindex10;
45 46
         width: 100%;
46 47
         box-sizing: border-box; // Includes the padding in the 100% width.
48
+
49
+        /**
50
+         * FIXME (lenny): Disabling pointer-events is a pretty big sin that
51
+         * sidesteps the problems. There are z-index wars occurring within
52
+         * videocontainer and AtlasKit Tooltips rely on their parent z-indexe
53
+         * being higher than whatever they need to appear over. So set a higher
54
+         * z-index for the tooltip containers but make any empty space not block
55
+         * mouse overs for various mouseover triggers.
56
+         */
57
+        pointer-events: none;
58
+
59
+        * {
60
+            pointer-events: auto;
61
+        }
62
+
63
+        .indicator-container {
64
+            display: inline-block;
65
+            float: left;
66
+            pointer-events: all;
67
+        }
47 68
     }
48 69
 
49 70
     &__toolbar {
@@ -69,24 +90,21 @@
69 90
             margin-top: $toolbarIconMargin;
70 91
         }
71 92
 
72
-        .indicator:nth-child(1) {
93
+        .indicator-container:nth-child(1) .indicator {
73 94
             margin-left: $toolbarIconMargin;
74 95
         }
75 96
 
76 97
         .connection-indicator,
77
-        span.indicator {
78
-            margin-right: em(5, 8);
98
+        div.indicator-container,
99
+         {
100
+            margin-right: 4px;
79 101
         }
80 102
 
81
-        span.indicator {
82
-            display: none;
83
-
84
-            &:last-child {
85
-                margin-right: 0;
86
-            }
103
+        div.indicator:last-child {
104
+            margin-right: 0;
87 105
         }
88 106
 
89
-        .connection-indicator-container {
107
+        .indicator-container {
90 108
             display: inline-block;
91 109
             vertical-align: top;
92 110
 
@@ -96,7 +114,7 @@
96 114
         }
97 115
 
98 116
         .connection-indicator,
99
-        span.indicator {
117
+        .indicator {
100 118
             position: relative;
101 119
             font-size: 8px;
102 120
             text-align: center;
@@ -307,7 +325,6 @@
307 325
     padding: 0;
308 326
     border: 0;
309 327
     margin: 0px 5px 0px 0px;
310
-    float: left;
311 328
 }
312 329
 
313 330
 /**
@@ -320,9 +337,17 @@
320 337
 /**
321 338
  * Toolbar icons positioned on the right.
322 339
  */
323
-.toolbar-icon.right {
324
-  float: right;
325
-  margin: 0px 0px 0px 5px;
340
+.moderator-icon {
341
+    display: inline-block;
342
+
343
+    &.right {
344
+        float: right;
345
+        margin: 0px 0px 0px 5px;
346
+    }
347
+
348
+    .toolbar-icon {
349
+        margin: 0;
350
+    }
326 351
 }
327 352
 
328 353
 .raisehandindicator {
@@ -340,7 +365,7 @@
340 365
     position: absolute;
341 366
     top: 0px;
342 367
     right: 0;
343
-    z-index: $zindex3;
368
+    z-index: $zindex2;
344 369
     width: 18px;
345 370
     height: 13px;
346 371
     color: #FFF;

+ 2
- 3
lang/main.json Näytä tiedosto

@@ -168,9 +168,8 @@
168 168
     },
169 169
     "videothumbnail":
170 170
     {
171
-        "editnickname": "Click to edit your<br/>display name",
172
-        "moderator": "The owner of<br/>this conference",
173
-        "videomute": "Participant has<br/>stopped the camera",
171
+        "moderator": "Moderator",
172
+        "videomute": "Participant has stopped the camera",
174 173
         "mute": "Participant is muted",
175 174
         "kick": "Kick out",
176 175
         "muted": "Muted",

+ 25
- 9
modules/UI/videolayout/SmallVideo.js Näytä tiedosto

@@ -316,16 +316,27 @@ SmallVideo.prototype.setVideoMutedView = function(isMuted) {
316 316
 SmallVideo.prototype.updateStatusBar = function () {
317 317
     const statusBarContainer
318 318
         = this.container.querySelector('.videocontainer__toolbar');
319
+    const tooltipPosition = interfaceConfig.VERTICAL_FILMSTRIP ? 'left' : 'top';
319 320
 
320 321
     /* jshint ignore:start */
321 322
     ReactDOM.render(
322
-        <div>
323
-            { this.isAudioMuted ? <AudioMutedIndicator /> : null }
324
-            { this.isVideoMuted ? <VideoMutedIndicator /> : null }
325
-            { this._isModerator
326
-                && !interfaceConfig.DISABLE_FOCUS_INDICATOR
327
-                    ? <ModeratorIndicator /> : null }
328
-        </div>,
323
+        <I18nextProvider i18n = { i18next }>
324
+            <div>
325
+                { this.isAudioMuted
326
+                    ? <AudioMutedIndicator
327
+                        tooltipPosition = { tooltipPosition } />
328
+                    : null }
329
+                { this.isVideoMuted
330
+                    ? <VideoMutedIndicator
331
+                        tooltipPosition = { tooltipPosition } />
332
+                    : null }
333
+                { this._isModerator
334
+                    && !interfaceConfig.DISABLE_FOCUS_INDICATOR
335
+                        ? <ModeratorIndicator
336
+                             tooltipPosition = { tooltipPosition } />
337
+                        : null }
338
+            </div>
339
+        </I18nextProvider>,
329 340
         statusBarContainer);
330 341
     /* jshint ignore:end */
331 342
 };
@@ -744,6 +755,7 @@ SmallVideo.prototype.updateIndicators = function () {
744 755
         = this.container.querySelector('.videocontainer__toptoolbar');
745 756
 
746 757
     const iconSize = UIUtil.getIndicatorFontSize();
758
+    const tooltipPosition = interfaceConfig.VERTICAL_FILMSTRIP ? 'left' : 'top';
747 759
 
748 760
     /* jshint ignore:start */
749 761
     ReactDOM.render(
@@ -758,10 +770,14 @@ SmallVideo.prototype.updateIndicators = function () {
758 770
                         userID = { this.id } />
759 771
                     : null }
760 772
                 { this._showRaisedHand
761
-                    ? <RaisedHandIndicator iconSize = { iconSize } />
773
+                    ? <RaisedHandIndicator
774
+                        iconSize = { iconSize }
775
+                        tooltipPosition = { tooltipPosition } />
762 776
                     : null }
763 777
                 { this._showDominantSpeaker
764
-                    ? <DominantSpeakerIndicator iconSize = { iconSize } />
778
+                    ? <DominantSpeakerIndicator
779
+                        iconSize = { iconSize }
780
+                        tooltipPosition = { tooltipPosition } />
765 781
                     : null }
766 782
             </div>
767 783
         </I18nextProvider>,

+ 1
- 1
react/features/connection-indicator/components/ConnectionIndicator.js Näytä tiedosto

@@ -175,7 +175,7 @@ class ConnectionIndicator extends Component {
175 175
      */
176 176
     render() {
177 177
         return (
178
-            <div className = 'connection-indicator-container'>
178
+            <div className = 'indicator-container'>
179 179
                 <AKInlineDialog
180 180
                     content = { this._renderStatisticsTable() }
181 181
                     isOpen = { this.state.showStats }

+ 14
- 1
react/features/filmstrip/components/web/AudioMutedIndicator.js Näytä tiedosto

@@ -8,6 +8,18 @@ import BaseIndicator from './BaseIndicator';
8 8
  * @extends Component
9 9
  */
10 10
 class AudioMutedIndicator extends Component {
11
+    /**
12
+     * {@code AudioMutedIndicator} component's property types.
13
+     *
14
+     * @static
15
+     */
16
+    static propTypes = {
17
+        /**
18
+         * From which side of the indicator the tooltip should appear from.
19
+         */
20
+        tooltipPosition: React.PropTypes.string
21
+    };
22
+
11 23
     /**
12 24
      * Implements React's {@link Component#render()}.
13 25
      *
@@ -19,7 +31,8 @@ class AudioMutedIndicator extends Component {
19 31
             <BaseIndicator
20 32
                 className = 'audioMuted toolbar-icon'
21 33
                 iconClassName = 'icon-mic-disabled'
22
-                tooltipKey = 'videothumbnail.mute' />
34
+                tooltipKey = 'videothumbnail.mute'
35
+                tooltipPosition = { this.props.tooltipPosition } />
23 36
         );
24 37
     }
25 38
 }

+ 50
- 71
react/features/filmstrip/components/web/BaseIndicator.js Näytä tiedosto

@@ -1,6 +1,7 @@
1 1
 import React, { Component } from 'react';
2
+import Tooltip from '@atlaskit/tooltip';
2 3
 
3
-import { setTooltip } from '../../../../../modules/UI/util/Tooltip';
4
+import { translate } from '../../../base/i18n';
4 5
 
5 6
 /**
6 7
  * React {@code Component} for showing an icon with a tooltip.
@@ -8,16 +9,27 @@ import { setTooltip } from '../../../../../modules/UI/util/Tooltip';
8 9
  * @extends Component
9 10
  */
10 11
 class BaseIndicator extends Component {
12
+    /**
13
+     * Default values for {@code BaseIndicator} component's properties.
14
+     *
15
+     * @static
16
+     */
11 17
     static defaultProps = {
12 18
         className: '',
13 19
         iconClassName: '',
14 20
         iconSize: 'auto',
15
-        id: ''
21
+        id: '',
22
+        tooltipPosition: 'top'
16 23
     };
17 24
 
25
+    /**
26
+     * {@code BaseIndicator} component's property types.
27
+     *
28
+     * @static
29
+     */
18 30
     static propTypes = {
19 31
         /**
20
-         * The CSS class names to set on the root element of the component.
32
+         * Additional CSS class names to set on the icon container.
21 33
          */
22 34
         className: React.PropTypes.string,
23 35
 
@@ -36,44 +48,23 @@ class BaseIndicator extends Component {
36 48
          */
37 49
         id: React.PropTypes.string,
38 50
 
51
+        /**
52
+         * Invoked to obtain translated strings.
53
+         */
54
+        t: React.PropTypes.func,
55
+
39 56
         /**
40 57
          * The translation key to use for displaying a tooltip when hovering
41 58
          * over the component.
42 59
          */
43
-        tooltipKey: React.PropTypes.string
44
-    };
45
-
46
-    /**
47
-     * Initializes a new {@code BaseIndicator} instance.
48
-     *
49
-     * @param {Object} props - The read-only properties with which the new
50
-     * instance is to be initialized.
51
-     */
52
-    constructor(props) {
53
-        super(props);
60
+        tooltipKey: React.PropTypes.string,
54 61
 
55 62
         /**
56
-         * An internal reference to the HTML element at the top of the
57
-         * component's DOM hierarchy. The reference is needed for attaching a
58
-         * tooltip.
59
-         *
60
-         * @type {HTMLElement}
63
+         * From which side of the indicator the tooltip should appear from.
64
+         * Defaults to "top".
61 65
          */
62
-        this._rootElement = null;
63
-
64
-        // Bind event handler so it is only bound once for every instance.
65
-        this._setRootElementRef = this._setRootElementRef.bind(this);
66
-    }
67
-
68
-    /**
69
-     * Sets a tooltip which will display when hovering over the component.
70
-     *
71
-     * @inheritdoc
72
-     * @returns {void}
73
-     */
74
-    componentDidMount() {
75
-        this._setTooltip();
76
-    }
66
+        tooltipPosition: React.PropTypes.string
67
+    };
77 68
 
78 69
     /**
79 70
      * Implements React's {@link Component#render()}.
@@ -82,46 +73,34 @@ class BaseIndicator extends Component {
82 73
      * @returns {ReactElement}
83 74
      */
84 75
     render() {
85
-        return (
86
-            <span
87
-                className = { this.props.className }
88
-                id = { this.props.id }
89
-                ref = { this._setRootElementRef }>
90
-                <i
91
-                    className = { this.props.iconClassName }
92
-                    style = {{ fontSize: this.props.iconSize }} />
93
-            </span>
94
-        );
95
-    }
76
+        const {
77
+            className,
78
+            iconClassName,
79
+            iconSize,
80
+            id,
81
+            t,
82
+            tooltipKey,
83
+            tooltipPosition
84
+        } = this.props;
96 85
 
97
-    /**
98
-     * Sets the internal reference to the root HTML element for the component.
99
-     *
100
-     * @param {HTMLIconElement} element - The root HTML element of the
101
-     * component.
102
-     * @private
103
-     * @returns {void}
104
-     */
105
-    _setRootElementRef(element) {
106
-        this._rootElement = element;
107
-    }
86
+        const iconContainerClassName = `indicator-icon-container ${className}`;
108 87
 
109
-    /**
110
-     * Associate the component as a tooltip trigger so a tooltip may display on
111
-     * hover.
112
-     *
113
-     * @private
114
-     * @returns {void}
115
-     */
116
-    _setTooltip() {
117
-        // TODO Replace UIUtil with an AtlasKit component when a suitable one
118
-        // becomes available for tooltips.
119
-        setTooltip(
120
-            this._rootElement,
121
-            this.props.tooltipKey,
122
-            'top'
88
+        return (
89
+            <div className = 'indicator-container'>
90
+                <Tooltip
91
+                    description = { t(tooltipKey) }
92
+                    position = { tooltipPosition }>
93
+                    <span
94
+                        className = { iconContainerClassName }
95
+                        id = { id }>
96
+                        <i
97
+                            className = { iconClassName }
98
+                            style = {{ fontSize: iconSize }} />
99
+                    </span>
100
+                </Tooltip>
101
+            </div>
123 102
         );
124 103
     }
125 104
 }
126 105
 
127
-export default BaseIndicator;
106
+export default translate(BaseIndicator);

+ 8
- 2
react/features/filmstrip/components/web/DominantSpeakerIndicator.js Näytä tiedosto

@@ -20,7 +20,12 @@ class DominantSpeakerIndicator extends Component {
20 20
          *
21 21
          * @type {number}
22 22
          */
23
-        iconSize: React.PropTypes.number
23
+        iconSize: React.PropTypes.number,
24
+
25
+        /**
26
+         * From which side of the indicator the tooltip should appear from.
27
+         */
28
+        tooltipPosition: React.PropTypes.string
24 29
     };
25 30
 
26 31
     /**
@@ -35,7 +40,8 @@ class DominantSpeakerIndicator extends Component {
35 40
                 iconClassName = 'indicatoricon fa fa-bullhorn'
36 41
                 iconSize = { `${this.props.iconSize}px` }
37 42
                 id = 'dominantspeakerindicator'
38
-                tooltipKey = 'speaker' />
43
+                tooltipKey = 'speaker'
44
+                tooltipPosition = { this.props.tooltipPosition } />
39 45
         );
40 46
     }
41 47
 }

+ 19
- 4
react/features/filmstrip/components/web/ModeratorIndicator.js Näytä tiedosto

@@ -8,6 +8,18 @@ import BaseIndicator from './BaseIndicator';
8 8
  * @extends Component
9 9
  */
10 10
 class ModeratorIndicator extends Component {
11
+    /**
12
+     * {@code ModeratorIndicator} component's property types.
13
+     *
14
+     * @static
15
+     */
16
+    static propTypes = {
17
+        /**
18
+         * From which side of the indicator the tooltip should appear from.
19
+         */
20
+        tooltipPosition: React.PropTypes.string
21
+    };
22
+
11 23
     /**
12 24
      * Implements React's {@link Component#render()}.
13 25
      *
@@ -16,10 +28,13 @@ class ModeratorIndicator extends Component {
16 28
      */
17 29
     render() {
18 30
         return (
19
-            <BaseIndicator
20
-                className = 'focusindicator toolbar-icon right'
21
-                iconClassName = 'icon-star'
22
-                tooltipKey = 'videothumbnail.moderator' />
31
+            <div className = 'moderator-icon right'>
32
+                <BaseIndicator
33
+                    className = 'focusindicator toolbar-icon'
34
+                    iconClassName = 'icon-star'
35
+                    tooltipKey = 'videothumbnail.moderator'
36
+                    tooltipPosition = { this.props.tooltipPosition } />
37
+            </div>
23 38
         );
24 39
     }
25 40
 }

+ 8
- 2
react/features/filmstrip/components/web/RaisedHandIndicator.js Näytä tiedosto

@@ -19,7 +19,12 @@ class RaisedHandIndicator extends Component {
19 19
          *
20 20
          * @type {number}
21 21
          */
22
-        iconSize: React.PropTypes.number
22
+        iconSize: React.PropTypes.number,
23
+
24
+        /**
25
+         * From which side of the indicator the tooltip should appear from.
26
+         */
27
+        tooltipPosition: React.PropTypes.string
23 28
     };
24 29
 
25 30
     /**
@@ -33,7 +38,8 @@ class RaisedHandIndicator extends Component {
33 38
                 className = 'raisehandindicator indicator show-inline'
34 39
                 iconClassName = 'icon-raised-hand indicatoricon'
35 40
                 iconSize = { `${this.props.iconSize}px` }
36
-                tooltipKey = 'raisedHand' />
41
+                tooltipKey = 'raisedHand'
42
+                tooltipPosition = { this.props.tooltipPosition } />
37 43
         );
38 44
     }
39 45
 }

+ 14
- 1
react/features/filmstrip/components/web/VideoMutedIndicator.js Näytä tiedosto

@@ -7,6 +7,18 @@ import BaseIndicator from './BaseIndicator';
7 7
  * @extends Component
8 8
  */
9 9
 class VideoMutedIndicator extends Component {
10
+    /**
11
+     * {@code VideoMutedIndicator} component's property types.
12
+     *
13
+     * @static
14
+     */
15
+    static propTypes = {
16
+        /**
17
+         * From which side of the indicator the tooltip should appear from.
18
+         */
19
+        tooltipPosition: React.PropTypes.string
20
+    };
21
+
10 22
     /**
11 23
      * Implements React's {@link Component#render()}.
12 24
      *
@@ -17,7 +29,8 @@ class VideoMutedIndicator extends Component {
17 29
             <BaseIndicator
18 30
                 className = 'videoMuted toolbar-icon'
19 31
                 iconClassName = 'icon-camera-disabled'
20
-                tooltipKey = 'videothumbnail.videomute' />
32
+                tooltipKey = 'videothumbnail.videomute'
33
+                tooltipPosition = { this.props.tooltipPosition } />
21 34
         );
22 35
     }
23 36
 }

Loading…
Peruuta
Tallenna