Browse Source

feat(device-selection): design tweaks (#2802)

- Change copy
- Add labels to dropdowns
- Adjust color and positioning
j8
virtuacoplenny 7 years ago
parent
commit
f4060975d1
No account linked to committer's email address

+ 7
- 8
css/modals/device-selection/_device-selection.scss View File

@@ -4,11 +4,7 @@
4 4
 
5 5
         > div {
6 6
             display: block;
7
-            margin-bottom: 10px;
8
-        }
9
-
10
-        > div:last-child {
11
-            margin-bottom: 5px;
7
+            margin-bottom: 4px;
12 8
         }
13 9
 
14 10
         .device-selector-icon {
@@ -18,6 +14,10 @@
18 14
             margin-left: 3px;
19 15
         }
20 16
 
17
+        .device-selector-label {
18
+            margin-bottom: 1px;
19
+        }
20
+
21 21
         /* device-selector-trigger stylings attempt to mimic AtlasKit button */
22 22
         .device-selector-trigger {
23 23
             background-color: #0E1624;
@@ -101,7 +101,6 @@
101 101
 
102 102
     .audio-output-preview {
103 103
         font-size: 14px;
104
-        margin-top: 10px;
105 104
 
106 105
         a {
107 106
             color: 4C9AFF;
@@ -111,9 +110,9 @@
111 110
     }
112 111
 
113 112
     .audio-input-preview {
114
-        background: #7b7b7b;
113
+        background: #1B2638;
115 114
         border-radius: 5px;
116
-        height: 6px;
115
+        height: 8px;
117 116
 
118 117
         .audio-input-preview-level {
119 118
             background: #4C9AFF;

+ 1
- 1
lang/main.json View File

@@ -440,7 +440,7 @@
440 440
         "noPermission": "Permission not granted",
441 441
         "previewUnavailable": "Preview unavailable",
442 442
         "selectADevice": "Select a device",
443
-        "testAudio": "Test sound"
443
+        "testAudio": "Play a test sound"
444 444
     },
445 445
     "videoStatus": {
446 446
         "callQuality": "Call Quality",

+ 2
- 2
modules/UI/UI.js View File

@@ -35,6 +35,7 @@ import {
35 35
     setNotificationsEnabled,
36 36
     showWarningNotification
37 37
 } from '../../react/features/notifications';
38
+import { shouldShowOnlyDeviceSelection } from '../../react/features/settings';
38 39
 import {
39 40
     dockToolbox,
40 41
     showToolbox
@@ -104,8 +105,7 @@ const UIListeners = new Map([
104 105
             // opened through a button in settings and not directly displayed in
105 106
             // settings itself. As it is not useful to only have a settings menu
106 107
             // with a button to open a dialog, open the dialog directly instead.
107
-            if (interfaceConfig.SETTINGS_SECTIONS.length === 1
108
-                    && UIUtil.isSettingEnabled('devices')) {
108
+            if (shouldShowOnlyDeviceSelection()) {
109 109
                 APP.store.dispatch(openDeviceSelectionDialog());
110 110
             } else {
111 111
                 UI.toggleSidePanel('settings_container');

+ 7
- 4
modules/UI/side_pannels/settings/SettingsMenu.js View File

@@ -8,7 +8,10 @@ import { I18nextProvider } from 'react-i18next';
8 8
 import { Provider } from 'react-redux';
9 9
 
10 10
 import { i18next } from '../../../../react/features/base/i18n';
11
-import { SettingsMenu } from '../../../../react/features/settings';
11
+import {
12
+    SettingsMenu,
13
+    isSettingEnabled
14
+} from '../../../../react/features/settings';
12 15
 import UIUtil from '../../util/UIUtil';
13 16
 
14 17
 /* eslint-enable no-unused-vars */
@@ -23,9 +26,9 @@ export default {
23 26
         $('#sideToolbarContainer').append(settingsMenuContainer);
24 27
 
25 28
         const props = {
26
-            showDeviceSettings: UIUtil.isSettingEnabled('devices'),
27
-            showLanguageSettings: UIUtil.isSettingEnabled('language'),
28
-            showModeratorSettings: UIUtil.isSettingEnabled('moderator'),
29
+            showDeviceSettings: isSettingEnabled('devices'),
30
+            showLanguageSettings: isSettingEnabled('language'),
31
+            showModeratorSettings: isSettingEnabled('moderator'),
29 32
             showTitles: interfaceConfig.SETTINGS_SECTIONS.length > 1
30 33
         };
31 34
 

+ 0
- 12
modules/UI/util/UIUtil.js View File

@@ -121,18 +121,6 @@ const UIUtil = {
121 121
         }
122 122
     },
123 123
 
124
-    /**
125
-     * Indicates if the setting section is enabled.
126
-     *
127
-     * @param name the name of the setting section as defined in
128
-     * interface_config.js and SettingsMenu.js
129
-     * @returns {boolean} {true} to indicate that the given setting section
130
-     * is enabled, {false} - otherwise
131
-     */
132
-    isSettingEnabled(name) {
133
-        return interfaceConfig.SETTINGS_SECTIONS.indexOf(name) !== -1;
134
-    },
135
-
136 124
     /**
137 125
      * Indicates if Authentication Section should be shown
138 126
      *

+ 29
- 5
react/features/device-selection/components/DeviceSelectionDialogBase.js View File

@@ -5,6 +5,8 @@ import { StatelessDialog } from '../../base/dialog';
5 5
 import { translate } from '../../base/i18n';
6 6
 import { createLocalTrack } from '../../base/lib-jitsi-meet';
7 7
 
8
+import { shouldShowOnlyDeviceSelection } from '../../settings';
9
+
8 10
 import AudioInputPreview from './AudioInputPreview';
9 11
 import AudioOutputPreview from './AudioOutputPreview';
10 12
 import DeviceSelector from './DeviceSelector';
@@ -218,7 +220,7 @@ class DeviceSelectionDialogBase extends Component {
218 220
                 okTitleKey = { 'dialog.Save' }
219 221
                 onCancel = { this._onCancel }
220 222
                 onSubmit = { this._onSubmit }
221
-                titleKey = 'deviceSelection.deviceSettings'>
223
+                titleKey = { this._getModalTitle() }>
222 224
                 <div className = 'device-selection'>
223 225
                     <div className = 'device-selection-column column-video'>
224 226
                         <div className = 'device-selection-video-container'>
@@ -275,6 +277,22 @@ class DeviceSelectionDialogBase extends Component {
275 277
             ? this.state.previewVideoTrack.dispose() : Promise.resolve();
276 278
     }
277 279
 
280
+    /**
281
+     * Returns what the title of the device selection modal should be.
282
+     *
283
+     * Note: This is temporary logic to appease design sooner. Device selection
284
+     * and all other settings will be combined into one modal.
285
+     *
286
+     * @returns {string}
287
+     */
288
+    _getModalTitle() {
289
+        if (shouldShowOnlyDeviceSelection()) {
290
+            return 'settings.title';
291
+        }
292
+
293
+        return 'deviceSelection.deviceSettings';
294
+    }
295
+
278 296
     /**
279 297
      * Disposes preview tracks and signals to
280 298
      * close DeviceSelectionDialogBase.
@@ -362,12 +380,18 @@ class DeviceSelectionDialogBase extends Component {
362 380
      * Creates a DeviceSelector instance based on the passed in configuration.
363 381
      *
364 382
      * @private
365
-     * @param {Object} props - The props for the DeviceSelector.
383
+     * @param {Object} deviceSelectorProps - The props for the DeviceSelector.
366 384
      * @returns {ReactElement}
367 385
      */
368
-    _renderSelector(props) {
386
+    _renderSelector(deviceSelectorProps) {
387
+
369 388
         return (
370
-            <DeviceSelector { ...props } />
389
+            <div key = { deviceSelectorProps.label }>
390
+                <div className = 'device-selector-label'>
391
+                    { this.props.t(deviceSelectorProps.label) }
392
+                </div>
393
+                <DeviceSelector { ...deviceSelectorProps } />
394
+            </div>
371 395
         );
372 396
     }
373 397
 
@@ -419,7 +443,7 @@ class DeviceSelectionDialogBase extends Component {
419 443
             });
420 444
         }
421 445
 
422
-        return configurations.map(this._renderSelector);
446
+        return configurations.map(config => this._renderSelector(config));
423 447
     }
424 448
 
425 449
     /**

+ 25
- 0
react/features/settings/functions.js View File

@@ -2,6 +2,20 @@
2 2
 
3 3
 import { parseStandardURIString } from '../base/util';
4 4
 
5
+declare var interfaceConfig: Object;
6
+
7
+/**
8
+ * Used for web. Indicates if the setting section is enabled.
9
+ *
10
+ * @param {string} settingName - The name of the setting section as defined in
11
+ * interface_config.js and SettingsMenu.js.
12
+ * @returns {boolean} True to indicate that the given setting section
13
+ * is enabled, false otherwise.
14
+ */
15
+export function isSettingEnabled(settingName: string) {
16
+    return interfaceConfig.SETTINGS_SECTIONS.includes(settingName);
17
+}
18
+
5 19
 /**
6 20
  * Normalizes a URL entered by the user.
7 21
  * FIXME: Consider adding this to base/util/uri.
@@ -35,3 +49,14 @@ export function normalizeUserInputURL(url: string) {
35 49
 
36 50
     /* eslint-enable no-param-reassign */
37 51
 }
52
+
53
+/**
54
+ * Used for web. Returns whether or not only Device Selection is configured to
55
+ * display as a setting.
56
+ *
57
+ * @returns {boolean}
58
+ */
59
+export function shouldShowOnlyDeviceSelection() {
60
+    return interfaceConfig.SETTINGS_SECTIONS.length === 1
61
+        && isSettingEnabled('devices');
62
+}

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

@@ -1,6 +1,7 @@
1 1
 export * from './actions';
2 2
 export * from './actionTypes';
3 3
 export * from './components';
4
+export * from './functions';
4 5
 
5 6
 import './middleware';
6 7
 import './reducer';

+ 2
- 2
react/features/toolbox/components/Toolbox.web.js View File

@@ -25,6 +25,7 @@ import { AddPeopleDialog, InfoDialogButton } from '../../invite';
25 25
 import { openKeyboardShortcutsDialog } from '../../keyboard-shortcuts';
26 26
 import { RECORDING_TYPES, toggleRecording } from '../../recording';
27 27
 import { toggleSharedVideo } from '../../shared-video';
28
+import { shouldShowOnlyDeviceSelection } from '../../settings';
28 29
 import { toggleChat, toggleProfile, toggleSettings } from '../../side-panel';
29 30
 import { SpeakerStats } from '../../speaker-stats';
30 31
 import {
@@ -535,8 +536,7 @@ class Toolbox extends Component<Props, State> {
535 536
      * @returns {void}
536 537
      */
537 538
     _doToggleSettings() {
538
-        if (interfaceConfig.SETTINGS_SECTIONS.length === 1
539
-            && interfaceConfig.SETTINGS_SECTIONS.includes('devices')) {
539
+        if (shouldShowOnlyDeviceSelection()) {
540 540
             this.props.dispatch(openDeviceSelectionDialog());
541 541
         } else {
542 542
             this.props.dispatch(toggleSettings());

Loading…
Cancel
Save