소스 검색

feat(Labels): Redo video quality label

Video quality label now becomes "performance settings".
All CSS for labels is moved to JS.
Overflow menu button is also changed to "performance settings".
master
Vlad Piersec 3 년 전
부모
커밋
bad8911fe8

+ 0
- 37
css/_labels.scss 파일 보기

@@ -1,37 +0,0 @@
1
-.label {
2
-    align-items: center;
3
-    background: #36383C;
4
-    border-radius: 3px;
5
-    color: #fff;
6
-    display: flex;
7
-    font-size: 12px;
8
-    font-weight: 600;
9
-    height: 28px;
10
-    margin: 0 0 4px 4px;
11
-    padding: 0 8px;
12
-
13
-    &--green {
14
-        background: #31B76A;
15
-    }
16
-
17
-    &--red {
18
-        background: #E34F56
19
-    }
20
-
21
-    &--white {
22
-        background: #fff;
23
-        color: #5e6d7a;
24
-
25
-        svg {
26
-            fill: #5e6d7a;
27
-        }
28
-    }
29
-}
30
-
31
-.label-text-with-icon {
32
-    margin-left: 8px;
33
-}
34
-
35
-.participants-count {
36
-    cursor: pointer;
37
-}

+ 0
- 1
css/main.scss 파일 보기

@@ -78,7 +78,6 @@ $flagsImagePath: "../images/";
78 78
 @import 'filmstrip/tile_view_overrides';
79 79
 @import 'filmstrip/vertical_filmstrip';
80 80
 @import 'filmstrip/vertical_filmstrip_overrides';
81
-@import 'labels';
82 81
 @import 'unsupported-browser/main';
83 82
 @import 'modals/invite/add-people';
84 83
 @import 'deep-linking/main';

+ 1
- 0
lang/main.json 파일 보기

@@ -1056,6 +1056,7 @@
1056 1056
         "ld": "LD",
1057 1057
         "ldTooltip": "Viewing low definition video",
1058 1058
         "lowDefinition": "Low definition",
1059
+        "performanceSettings": "Performance settings",
1059 1060
         "sd": "SD",
1060 1061
         "sdTooltip": "Viewing standard definition video",
1061 1062
         "standardDefinition": "Standard definition"

+ 8
- 0
react/features/base/icons/svg/gauge.svg 파일 보기

@@ -0,0 +1,8 @@
1
+<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+<mask id="path-1-outside-1" maskUnits="userSpaceOnUse" x="0.666687" y="1.5" width="18" height="16" fill="black">
3
+<rect fill="white" x="0.666687" y="1.5" width="18" height="16"/>
4
+<path fill-rule="evenodd" clip-rule="evenodd" d="M10 4.01515C8.65151 4.01515 7.33329 4.41503 6.21204 5.16422C5.0908 5.91341 4.2169 6.97827 3.70084 8.22413C3.18479 9.46998 3.04977 10.8409 3.31285 12.1635C3.57593 13.4861 4.2253 14.701 5.17884 15.6545L4.10747 16.7259C2.94203 15.5604 2.14836 14.0756 1.82681 12.4591C1.50527 10.8426 1.6703 9.16702 2.30103 7.6443C2.93176 6.12159 3.99986 4.8201 5.37027 3.90442C6.74068 2.98874 8.35184 2.5 10 2.5C11.6482 2.5 13.2594 2.98874 14.6298 3.90442C16.0002 4.8201 17.0683 6.12159 17.699 7.6443C18.3297 9.16702 18.4948 10.8426 18.1732 12.4591C17.8517 14.0756 17.058 15.5604 15.8926 16.7259L14.8212 15.6545C15.7747 14.701 16.4241 13.4861 16.6872 12.1635C16.9503 10.8409 16.8152 9.46998 16.2992 8.22413C15.7831 6.97827 14.9092 5.91341 13.788 5.16422C12.6668 4.41503 11.3485 4.01515 10 4.01515ZM9.55624 12.0731L8.48487 11.0017L8.48486 11.0017L9.55623 12.0731L9.55624 12.0731ZM13.6591 7.83508L12.7229 6.89887L8.04131 10.9867L9.57123 12.5166L13.6591 7.83508Z"/>
5
+</mask>
6
+<path fill-rule="evenodd" clip-rule="evenodd" d="M10 4.01515C8.65151 4.01515 7.33329 4.41503 6.21204 5.16422C5.0908 5.91341 4.2169 6.97827 3.70084 8.22413C3.18479 9.46998 3.04977 10.8409 3.31285 12.1635C3.57593 13.4861 4.2253 14.701 5.17884 15.6545L4.10747 16.7259C2.94203 15.5604 2.14836 14.0756 1.82681 12.4591C1.50527 10.8426 1.6703 9.16702 2.30103 7.6443C2.93176 6.12159 3.99986 4.8201 5.37027 3.90442C6.74068 2.98874 8.35184 2.5 10 2.5C11.6482 2.5 13.2594 2.98874 14.6298 3.90442C16.0002 4.8201 17.0683 6.12159 17.699 7.6443C18.3297 9.16702 18.4948 10.8426 18.1732 12.4591C17.8517 14.0756 17.058 15.5604 15.8926 16.7259L14.8212 15.6545C15.7747 14.701 16.4241 13.4861 16.6872 12.1635C16.9503 10.8409 16.8152 9.46998 16.2992 8.22413C15.7831 6.97827 14.9092 5.91341 13.788 5.16422C12.6668 4.41503 11.3485 4.01515 10 4.01515ZM9.55624 12.0731L8.48487 11.0017L8.48486 11.0017L9.55623 12.0731L9.55624 12.0731ZM13.6591 7.83508L12.7229 6.89887L8.04131 10.9867L9.57123 12.5166L13.6591 7.83508Z" fill="white"/>
7
+<path d="M6.21204 5.16422L6.10093 4.99793L6.21204 5.16422ZM3.70084 8.22413L3.88562 8.30066L3.70084 8.22413ZM3.31285 12.1635L3.50901 12.1245L3.31285 12.1635ZM5.17884 15.6545L5.32026 15.7959L5.46168 15.6545L5.32026 15.5131L5.17884 15.6545ZM4.10747 16.7259L3.96605 16.8673L4.10747 17.0087L4.24889 16.8673L4.10747 16.7259ZM1.82681 12.4591L1.63066 12.4981L1.82681 12.4591ZM2.30103 7.6443L2.11625 7.56777H2.11625L2.30103 7.6443ZM5.37027 3.90442L5.48138 4.07071V4.07071L5.37027 3.90442ZM14.6298 3.90442L14.5187 4.07071L14.6298 3.90442ZM17.699 7.6443L17.8838 7.56777L17.699 7.6443ZM18.1732 12.4591L18.3694 12.4981L18.1732 12.4591ZM15.8926 16.7259L15.7512 16.8673L15.8926 17.0087L16.034 16.8673L15.8926 16.7259ZM14.8212 15.6545L14.6798 15.5131L14.5384 15.6545L14.6798 15.7959L14.8212 15.6545ZM16.6872 12.1635L16.8833 12.2025L16.6872 12.1635ZM16.2992 8.22413L16.484 8.14759L16.2992 8.22413ZM13.788 5.16422L13.8991 4.99793L13.788 5.16422ZM8.48487 11.0017L8.62629 10.8603L8.39598 10.63L8.29477 10.9396L8.48487 11.0017ZM9.55624 12.0731L9.74634 12.1352L9.7845 12.0185L9.69766 11.9317L9.55624 12.0731ZM8.48486 11.0017L8.29476 10.9396L8.2566 11.0563L8.34344 11.1431L8.48486 11.0017ZM9.55623 12.0731L9.41481 12.2145L9.64512 12.4448L9.74633 12.1353L9.55623 12.0731ZM12.7229 6.89887L12.8643 6.75745L12.7321 6.62528L12.5913 6.74822L12.7229 6.89887ZM13.6591 7.83508L13.8097 7.96662L13.9327 7.82582L13.8005 7.69365L13.6591 7.83508ZM8.04131 10.9867L7.90977 10.8361L7.74857 10.9768L7.89989 11.1282L8.04131 10.9867ZM9.57123 12.5166L9.42981 12.6581L9.58113 12.8094L9.72188 12.6482L9.57123 12.5166ZM6.32316 5.33051C7.41151 4.6033 8.69107 4.21515 10 4.21515V3.81515C8.61195 3.81515 7.25506 4.22676 6.10093 4.99793L6.32316 5.33051ZM3.88562 8.30066C4.38653 7.09135 5.2348 6.05773 6.32316 5.33051L6.10093 4.99793C4.9468 5.76909 4.04726 6.86518 3.51607 8.14759L3.88562 8.30066ZM3.50901 12.1245C3.25364 10.8407 3.38471 9.50998 3.88562 8.30066L3.51607 8.14759C2.98488 9.42999 2.8459 10.8411 3.11669 12.2025L3.50901 12.1245ZM5.32026 15.5131C4.39469 14.5875 3.76437 13.4083 3.50901 12.1245L3.11669 12.2025C3.38749 13.5639 4.05591 14.8144 5.03742 15.7959L5.32026 15.5131ZM4.24889 16.8673L5.32026 15.7959L5.03742 15.5131L3.96604 16.5845L4.24889 16.8673ZM1.63066 12.4981C1.95992 14.1534 2.77264 15.6739 3.96605 16.8673L4.24889 16.5845C3.11142 15.447 2.3368 13.9978 2.02297 12.4201L1.63066 12.4981ZM2.11625 7.56777C1.47038 9.12703 1.3014 10.8428 1.63066 12.4981L2.02297 12.4201C1.70914 10.8424 1.87021 9.20701 2.4858 7.72084L2.11625 7.56777ZM5.25916 3.73813C3.85586 4.67578 2.76212 6.0085 2.11625 7.56777L2.4858 7.72084C3.1014 6.23467 4.14387 4.96441 5.48138 4.07071L5.25916 3.73813ZM10 2.3C8.31229 2.3 6.66246 2.80047 5.25916 3.73813L5.48138 4.07071C6.8189 3.17701 8.3914 2.7 10 2.7V2.3ZM14.7409 3.73813C13.3376 2.80047 11.6878 2.3 10 2.3V2.7C11.6086 2.7 13.1811 3.17701 14.5187 4.07071L14.7409 3.73813ZM17.8838 7.56777C17.2379 6.0085 16.1442 4.67578 14.7409 3.73813L14.5187 4.07071C15.8562 4.96441 16.8986 6.23467 17.5142 7.72084L17.8838 7.56777ZM18.3694 12.4981C18.6986 10.8428 18.5297 9.12703 17.8838 7.56777L17.5142 7.72084C18.1298 9.20701 18.2909 10.8424 17.9771 12.4201L18.3694 12.4981ZM16.034 16.8673C17.2274 15.6739 18.0401 14.1534 18.3694 12.4981L17.9771 12.4201C17.6632 13.9978 16.8886 15.447 15.7512 16.5845L16.034 16.8673ZM14.6798 15.7959L15.7512 16.8673L16.034 16.5845L14.9626 15.5131L14.6798 15.7959ZM16.491 12.1245C16.2357 13.4083 15.6053 14.5875 14.6798 15.5131L14.9626 15.7959C15.9441 14.8144 16.6125 13.5639 16.8833 12.2025L16.491 12.1245ZM16.1144 8.30066C16.6153 9.50998 16.7464 10.8407 16.491 12.1245L16.8833 12.2025C17.1541 10.8411 17.0152 9.42999 16.484 8.14759L16.1144 8.30066ZM13.6769 5.33051C14.7652 6.05773 15.6135 7.09135 16.1144 8.30066L16.484 8.14759C15.9528 6.86518 15.0532 5.76909 13.8991 4.99793L13.6769 5.33051ZM10 4.21515C11.309 4.21515 12.5885 4.6033 13.6769 5.33051L13.8991 4.99793C12.745 4.22676 11.3881 3.81515 10 3.81515V4.21515ZM8.34344 11.1431L9.41482 12.2145L9.69766 11.9317L8.62629 10.8603L8.34344 11.1431ZM8.67496 11.0639L8.67496 11.0639L8.29477 10.9396L8.29476 10.9396L8.67496 11.0639ZM9.69765 11.9317L8.62628 10.8603L8.34344 11.1431L9.41481 12.2145L9.69765 11.9317ZM9.36614 12.0109L9.36613 12.011L9.74633 12.1353L9.74634 12.1352L9.36614 12.0109ZM12.5815 7.04029L13.5177 7.9765L13.8005 7.69365L12.8643 6.75745L12.5815 7.04029ZM8.17286 11.1374L12.8544 7.04952L12.5913 6.74822L7.90977 10.8361L8.17286 11.1374ZM9.71265 12.3752L8.18273 10.8453L7.89989 11.1282L9.42981 12.6581L9.71265 12.3752ZM13.5084 7.70353L9.42058 12.3851L9.72188 12.6482L13.8097 7.96662L13.5084 7.70353Z" fill="white" mask="url(#path-1-outside-1)"/>
8
+</svg>

+ 1
- 0
react/features/base/icons/svg/index.js 파일 보기

@@ -33,6 +33,7 @@ export { default as IconCloseX } from './close-x.svg';
33 33
 export { default as IconClosedCaption } from './closed_caption.svg';
34 34
 export { default as IconCloseSmall } from './close-small.svg';
35 35
 export { default as IconCodeBlock } from './code-block.svg';
36
+export { default as IconGauge } from './gauge.svg';
36 37
 export { default as IconConnectionActive } from './gsm-bars.svg';
37 38
 export { default as IconConnectionInactive } from './ninja.svg';
38 39
 export { default as IconCopy } from './copy.svg';

+ 83
- 9
react/features/base/label/components/Label.web.js 파일 보기

@@ -1,8 +1,11 @@
1 1
 // @flow
2
-
2
+import { withStyles } from '@material-ui/core/styles';
3
+import clsx from 'clsx';
3 4
 import React from 'react';
4 5
 
5 6
 import Icon from '../../icons/components/Icon';
7
+import { withPixelLineHeight } from '../../styles/functions.web';
8
+import { COLORS } from '../constants';
6 9
 
7 10
 import AbstractLabel, {
8 11
     type Props as AbstractProps
@@ -11,23 +14,84 @@ import AbstractLabel, {
11 14
 type Props = AbstractProps & {
12 15
 
13 16
     /**
14
-     * Additional CSS class names to add to the root of {@code Label}.
17
+     * An object containing the CSS classes.
18
+     */
19
+    classes: Object,
20
+
21
+    /**
22
+     * Own CSS class name.
15 23
      */
16 24
     className: string,
17 25
 
26
+    /**
27
+     * The color of the label.
28
+     */
29
+    color: string,
30
+
31
+
18 32
     /**
19 33
      * HTML ID attribute to add to the root of {@code Label}.
20 34
      */
21
-    id: string
35
+    id: string,
36
+
37
+    /**
38
+     * Click handler if any.
39
+     */
40
+    onClick?: Function,
22 41
 
23 42
 };
24 43
 
44
+/**
45
+ * Creates the styles for the component.
46
+ *
47
+ * @param {Object} theme - The current UI theme.
48
+ *
49
+ * @returns {Object}
50
+ */
51
+const styles = theme => {
52
+    return {
53
+        label: {
54
+            ...withPixelLineHeight(theme.typography.labelRegular),
55
+
56
+            alignItems: 'center',
57
+            background: theme.palette.ui04,
58
+            borderRadius: theme.shape.borderRadius / 2,
59
+            color: theme.palette.text01,
60
+            display: 'flex',
61
+            height: 28,
62
+            margin: '0 0 4px 4px',
63
+            padding: '0 8px'
64
+        },
65
+        withIcon: {
66
+            marginLeft: 8
67
+        },
68
+        clickable: {
69
+            cursor: 'pointer'
70
+        },
71
+        [COLORS.white]: {
72
+            background: theme.palette.text01,
73
+            color: theme.palette.ui04,
74
+
75
+            '& svg': {
76
+                fill: theme.palette.ui04
77
+            }
78
+        },
79
+        [COLORS.green]: {
80
+            background: theme.palette.success02
81
+        },
82
+        [COLORS.red]: {
83
+            background: theme.palette.actionDanger
84
+        }
85
+    };
86
+};
87
+
88
+
25 89
 /**
26 90
  * React Component for showing short text in a circle.
27 91
  *
28 92
  * @extends Component
29 93
  */
30
-export default class Label extends AbstractLabel<Props, *> {
94
+class Label extends AbstractLabel<Props, *> {
31 95
     /**
32 96
      * Implements React's {@link Component#render()}.
33 97
      *
@@ -35,23 +99,33 @@ export default class Label extends AbstractLabel<Props, *> {
35 99
      */
36 100
     render() {
37 101
         const {
102
+            classes,
38 103
             className,
104
+            color,
39 105
             icon,
40 106
             id,
107
+            onClick,
41 108
             text
42 109
         } = this.props;
43
-
44
-        const labelClassName = icon ? 'label-text-with-icon' : '';
110
+        const labelClassName = clsx(
111
+            classes.label,
112
+            onClick && classes.clickable,
113
+            color && classes[color],
114
+            className
115
+        );
45 116
 
46 117
         return (
47 118
             <div
48
-                className = { `label ${className}` }
49
-                id = { id }>
119
+                className = { labelClassName }
120
+                id = { id }
121
+                onClick = { onClick }>
50 122
                 { icon && <Icon
51 123
                     size = '16'
52 124
                     src = { icon } /> }
53
-                { text && <span className = { labelClassName }>{text}</span> }
125
+                { text && <span className = { icon && classes.withIcon }>{text}</span> }
54 126
             </div>
55 127
         );
56 128
     }
57 129
 }
130
+
131
+export default withStyles(styles)(Label);

+ 7
- 0
react/features/base/label/constants.js 파일 보기

@@ -0,0 +1,7 @@
1
+// @flow
2
+
3
+export const COLORS = {
4
+    white: 'white',
5
+    green: 'green',
6
+    red: 'red'
7
+};

+ 2
- 1
react/features/conference/components/web/InsecureRoomNameLabel.js 파일 보기

@@ -6,6 +6,7 @@ import React from 'react';
6 6
 import { translate } from '../../../base/i18n';
7 7
 import { IconWarning } from '../../../base/icons';
8 8
 import { Label } from '../../../base/label';
9
+import { COLORS } from '../../../base/label/constants';
9 10
 import { connect } from '../../../base/redux';
10 11
 import AbstractInsecureRoomNameLabel, { _mapStateToProps } from '../AbstractInsecureRoomNameLabel';
11 12
 
@@ -24,7 +25,7 @@ class InsecureRoomNameLabel extends AbstractInsecureRoomNameLabel {
24 25
                 content = { this.props.t('security.insecureRoomNameWarning') }
25 26
                 position = 'bottom'>
26 27
                 <Label
27
-                    className = 'label--red'
28
+                    color = { COLORS.red }
28 29
                     icon = { IconWarning } />
29 30
             </Tooltip>
30 31
         );

+ 6
- 8
react/features/conference/components/web/ParticipantsCount.js 파일 보기

@@ -6,6 +6,7 @@ import type { Dispatch } from 'redux';
6 6
 import { openDialog } from '../../../base/dialog';
7 7
 import { IconUserGroups } from '../../../base/icons';
8 8
 import { Label } from '../../../base/label';
9
+import { COLORS } from '../../../base/label/constants';
9 10
 import { getParticipantCount } from '../../../base/participants';
10 11
 import { connect } from '../../../base/redux';
11 12
 import { SpeakerStats } from '../../../speaker-stats';
@@ -79,14 +80,11 @@ class ParticipantsCount extends PureComponent<Props> {
79 80
         }
80 81
 
81 82
         return (
82
-            <div
83
-                className = 'participants-count'
84
-                onClick = { this._onClick }>
85
-                <Label
86
-                    className = 'label--white'
87
-                    icon = { IconUserGroups }
88
-                    text = { count } />
89
-            </div>
83
+            <Label
84
+                color = { COLORS.white }
85
+                icon = { IconUserGroups }
86
+                onClick = { this._onClick }
87
+                text = { count } />
90 88
         );
91 89
     }
92 90
 }

+ 2
- 1
react/features/e2ee/components/E2EELabel.js 파일 보기

@@ -5,6 +5,7 @@ import React, { Component } from 'react';
5 5
 import { translate } from '../../base/i18n';
6 6
 import { IconE2EE } from '../../base/icons';
7 7
 import { Label } from '../../base/label';
8
+import { COLORS } from '../../base/label/constants';
8 9
 import { connect } from '../../base/redux';
9 10
 import { Tooltip } from '../../base/tooltip';
10 11
 
@@ -36,7 +37,7 @@ class E2EELabel extends Component<Props> {
36 37
                 content = { content }
37 38
                 position = { 'bottom' }>
38 39
                 <Label
39
-                    className = 'label--green'
40
+                    color = { COLORS.green }
40 41
                     icon = { IconE2EE } />
41 42
             </Tooltip>
42 43
         );

+ 5
- 67
react/features/video-quality/components/VideoQualityButton.web.js 파일 보기

@@ -1,29 +1,8 @@
1 1
 // @flow
2 2
 
3 3
 import { translate } from '../../base/i18n';
4
-import {
5
-    IconVideoQualityAudioOnly,
6
-    IconVideoQualityHD,
7
-    IconVideoQualityLD,
8
-    IconVideoQualitySD
9
-} from '../../base/icons';
10
-import { connect } from '../../base/redux';
4
+import { IconGauge } from '../../base/icons';
11 5
 import { AbstractButton, type AbstractButtonProps } from '../../base/toolbox/components';
12
-import { VIDEO_QUALITY_LEVELS } from '../constants';
13
-import { findNearestQualityLevel } from '../functions';
14
-
15
-/**
16
- * A map of of selectable receive resolutions to corresponding icons.
17
- *
18
- * @private
19
- * @type {Object}
20
- */
21
-const VIDEO_QUALITY_TO_ICON = {
22
-    [VIDEO_QUALITY_LEVELS.ULTRA]: IconVideoQualityHD,
23
-    [VIDEO_QUALITY_LEVELS.HIGH]: IconVideoQualityHD,
24
-    [VIDEO_QUALITY_LEVELS.STANDARD]: IconVideoQualitySD,
25
-    [VIDEO_QUALITY_LEVELS.LOW]: IconVideoQualityLD
26
-};
27 6
 
28 7
 /**
29 8
  * The type of the React {@code Component} props of
@@ -57,32 +36,10 @@ type Props = AbstractButtonProps & {
57 36
  */
58 37
 class VideoQualityButton extends AbstractButton<Props, *> {
59 38
     accessibilityLabel = 'toolbar.accessibilityLabel.callQuality';
60
-    label = 'toolbar.callQuality';
61
-    tooltip = 'toolbar.callQuality';
39
+    label = 'videoStatus.performanceSettings';
40
+    tooltip = 'videoStatus.performanceSettings';
41
+    icon = IconGauge;
62 42
 
63
-    /**
64
-     * Dynamically retrieves the icon.
65
-     */
66
-    get icon() {
67
-        const { _audioOnly, _videoQuality } = this.props;
68
-
69
-        const videoQualityLevel = findNearestQualityLevel(_videoQuality);
70
-
71
-        const icon = _audioOnly || !videoQualityLevel
72
-            ? IconVideoQualityAudioOnly
73
-            : VIDEO_QUALITY_TO_ICON[videoQualityLevel];
74
-
75
-        return icon;
76
-    }
77
-
78
-    /**
79
-     * Required by linter due to AbstractButton overwritten prop being writable.
80
-     *
81
-     * @param {string} value - The icon value.
82
-     */
83
-    set icon(value) {
84
-        return value;
85
-    }
86 43
 
87 44
     /**
88 45
      * Handles clicking / pressing the button.
@@ -102,23 +59,4 @@ class VideoQualityButton extends AbstractButton<Props, *> {
102 59
     }
103 60
 }
104 61
 
105
-/**
106
- * Maps (parts of) the Redux state to the associated props for the
107
- * {@code VideoQualityButton} component.
108
- *
109
- * @param {Object} state - The Redux state.
110
- * @private
111
- * @returns {{
112
- *     _audioOnly: boolean,
113
- *     _videoQuality: number
114
- * }}
115
- */
116
-function _mapStateToProps(state) {
117
-    return {
118
-        _audioOnly: state['features/base/audio-only'].enabled,
119
-        _videoQuality: state['features/video-quality'].preferredVideoQuality
120
-    };
121
-}
122
-
123
-export default translate(
124
-    connect(_mapStateToProps)(VideoQualityButton));
62
+export default translate(VideoQualityButton);

+ 1
- 19
react/features/video-quality/components/VideoQualityLabel.native.js 파일 보기

@@ -53,22 +53,4 @@ class VideoQualityLabel extends AbstractVideoQualityLabel<Props> {
53 53
     }
54 54
 }
55 55
 
56
-/**
57
- * Maps (parts of) the Redux state to the associated
58
- * {@code VideoQualityLabel}'s props.
59
- *
60
- * NOTE: This component has no props other than the abstract ones but keeping
61
- * the coding style the same for consistency reasons.
62
- *
63
- * @param {Object} state - The Redux state.
64
- * @private
65
- * @returns {{
66
- * }}
67
- */
68
-function _mapStateToProps(state: Object) {
69
-    return {
70
-        ..._abstractMapStateToProps(state)
71
-    };
72
-}
73
-
74
-export default translate(connect(_mapStateToProps)(VideoQualityLabel));
56
+export default translate(connect(_abstractMapStateToProps)(VideoQualityLabel));

+ 14
- 97
react/features/video-quality/components/VideoQualityLabel.web.js 파일 보기

@@ -2,71 +2,40 @@
2 2
 
3 3
 import React from 'react';
4 4
 
5
+import { openDialog } from '../../base/dialog';
5 6
 import { translate } from '../../base/i18n';
7
+import { IconGauge } from '../../base/icons';
6 8
 import { Label } from '../../base/label';
7
-import { MEDIA_TYPE } from '../../base/media';
8 9
 import { connect } from '../../base/redux';
9 10
 import { Tooltip } from '../../base/tooltip';
10
-import { getTrackByMediaTypeAndParticipant } from '../../base/tracks';
11 11
 import { shouldDisplayTileView } from '../../video-layout';
12 12
 
13 13
 import AbstractVideoQualityLabel, {
14 14
     _abstractMapStateToProps,
15 15
     type Props as AbstractProps
16 16
 } from './AbstractVideoQualityLabel';
17
+import VideoQualityDialog from './VideoQualityDialog.web';
17 18
 
18 19
 declare var interfaceConfig: Object;
19 20
 
20 21
 type Props = AbstractProps & {
21 22
 
22 23
     /**
23
-     * The message to show within the label.
24
+     * The redux dispatch function.
24 25
      */
25
-    _labelKey: string,
26
-
27
-    /**
28
-     * Whether to show video quality label or not.
29
-     */
30
-     _showVideoQualityLabel: boolean,
26
+    dispatch: Function,
31 27
 
32 28
     /**
33 29
      * The message to show within the label's tooltip.
34 30
      */
35 31
     _tooltipKey: string,
36 32
 
37
-    /**
38
-     * The redux representation of the JitsiTrack displayed on large video.
39
-     */
40
-    _videoTrack: Object,
41
-
42 33
     /**
43 34
      * Flag controlling visibility of the component.
44 35
      */
45 36
     _visible: boolean,
46 37
 };
47 38
 
48
-/**
49
- * A map of video resolution (number) to translation key.
50
- *
51
- * @type {Object}
52
- */
53
-const RESOLUTION_TO_TRANSLATION_KEY = {
54
-    '720': 'videoStatus.hd',
55
-    '360': 'videoStatus.sd',
56
-    '180': 'videoStatus.ld'
57
-};
58
-
59
-/**
60
- * Expected video resolutions placed into an array, sorted from lowest to
61
- * highest resolution.
62
- *
63
- * @type {number[]}
64
- */
65
-const RESOLUTIONS
66
-    = Object.keys(RESOLUTION_TO_TRANSLATION_KEY)
67
-        .map(resolution => parseInt(resolution, 10))
68
-        .sort((a, b) => a - b);
69
-
70 39
 /**
71 40
  * React {@code Component} responsible for displaying a label that indicates
72 41
  * the displayed video state of the current conference. {@code AudioOnlyLabel}
@@ -85,10 +54,8 @@ export class VideoQualityLabel extends AbstractVideoQualityLabel<Props> {
85 54
     render() {
86 55
         const {
87 56
             _audioOnly,
88
-            _labelKey,
89
-            _tooltipKey,
90
-            _videoTrack,
91 57
             _visible,
58
+            dispatch,
92 59
             t
93 60
         } = this.props;
94 61
 
@@ -97,20 +64,17 @@ export class VideoQualityLabel extends AbstractVideoQualityLabel<Props> {
97 64
             return null;
98 65
         }
99 66
 
100
-        let className, labelContent, tooltipKey;
67
+        let className, icon, labelContent, onClick, tooltipKey;
101 68
 
102 69
         if (_audioOnly) {
103 70
             className = 'audio-only';
104 71
             labelContent = t('videoStatus.audioOnly');
105 72
             tooltipKey = 'videoStatus.labelTooltipAudioOnly';
106
-        } else if (!_videoTrack || _videoTrack.muted) {
107
-            className = 'no-video';
108
-            labelContent = t('videoStatus.audioOnly');
109
-            tooltipKey = 'videoStatus.labelTooiltipNoVideo';
110 73
         } else {
111 74
             className = 'current-video-quality';
112
-            labelContent = t(_labelKey);
113
-            tooltipKey = _tooltipKey;
75
+            icon = IconGauge;
76
+            onClick = () => dispatch(openDialog(VideoQualityDialog));
77
+            tooltipKey = 'videoStatus.performanceSettings';
114 78
         }
115 79
 
116 80
 
@@ -120,47 +84,15 @@ export class VideoQualityLabel extends AbstractVideoQualityLabel<Props> {
120 84
                 position = { 'bottom' }>
121 85
                 <Label
122 86
                     className = { className }
87
+                    icon = { icon }
123 88
                     id = 'videoResolutionLabel'
89
+                    onClick = { onClick }
124 90
                     text = { labelContent } />
125 91
             </Tooltip>
126 92
         );
127 93
     }
128 94
 }
129 95
 
130
-/**
131
- * Matches the passed in resolution with a translation keys for describing
132
- * the resolution. The passed in resolution will be matched with a known
133
- * resolution that it is at least greater than or equal to.
134
- *
135
- * @param {number} resolution - The video height to match with a
136
- * translation.
137
- * @private
138
- * @returns {Object}
139
- */
140
-function _mapResolutionToTranslationsKeys(resolution) {
141
-    // Set the default matching resolution of the lowest just in case a match is
142
-    // not found.
143
-    let highestMatchingResolution = RESOLUTIONS[0];
144
-
145
-    for (let i = 0; i < RESOLUTIONS.length; i++) {
146
-        const knownResolution = RESOLUTIONS[i];
147
-
148
-        if (resolution >= knownResolution) {
149
-            highestMatchingResolution = knownResolution;
150
-        } else {
151
-            break;
152
-        }
153
-    }
154
-
155
-    const labelKey
156
-        = RESOLUTION_TO_TRANSLATION_KEY[highestMatchingResolution];
157
-
158
-    return {
159
-        labelKey,
160
-        tooltipKey: `${labelKey}Tooltip`
161
-    };
162
-}
163
-
164 96
 /**
165 97
  * Maps (parts of) the Redux state to the associated {@code VideoQualityLabel}'s
166 98
  * props.
@@ -168,28 +100,13 @@ function _mapResolutionToTranslationsKeys(resolution) {
168 100
  * @param {Object} state - The Redux state.
169 101
  * @private
170 102
  * @returns {{
171
- *     _labelKey: string,
172
- *     _tooltipKey: string,
173
- *     _videoTrack: Object
103
+ *     _audioOnly: boolean,
104
+ *     _visible: boolean
174 105
  * }}
175 106
  */
176 107
 function _mapStateToProps(state) {
177
-    const { enabled: audioOnly } = state['features/base/audio-only'];
178
-    const { resolution, participantId } = state['features/large-video'];
179
-    const videoTrackOnLargeVideo = getTrackByMediaTypeAndParticipant(
180
-        state['features/base/tracks'],
181
-        MEDIA_TYPE.VIDEO,
182
-        participantId
183
-    );
184
-
185
-    const translationKeys
186
-        = audioOnly ? {} : _mapResolutionToTranslationsKeys(resolution);
187
-
188 108
     return {
189 109
         ..._abstractMapStateToProps(state),
190
-        _labelKey: translationKeys.labelKey,
191
-        _tooltipKey: translationKeys.tooltipKey,
192
-        _videoTrack: videoTrackOnLargeVideo,
193 110
         _visible: !(shouldDisplayTileView(state) || interfaceConfig.VIDEO_QUALITY_LABEL_DISABLED)
194 111
     };
195 112
 }

Loading…
취소
저장