Browse Source

feat(MainToolbar): implement custom order.

As part of the PR, it also fixes:
 - Removes button aliases
 - Unifies the keys in the object returned by getAllToolboxButtons and the button keys
 - Makes sure that the number of buttons displayed are always the same as the number of buttons specified in the thresholds and removes the exception for not filling up the main toolbar with buttons from overflow menu when reactions button is disabled.
 - Introduces a priority for buttons that will be used to fill empty spaces in the main toolbar.
factor2
Hristo Terezov 1 year ago
parent
commit
0913554af9

+ 16
- 0
config.js View File

848
     //     autoHideWhileChatIsOpen: false,
848
     //     autoHideWhileChatIsOpen: false,
849
     // },
849
     // },
850
 
850
 
851
+    // Overrides the buttons displayed in the main toolbar. Depending on the screen size the number of displayed
852
+    // buttons varies from 2 buttons to 8 buttons. Every array in the mainToolbarButtons array will replace the
853
+    // corresponding default buttons configuration matched by the number of buttons specified in the array. Arrays with
854
+    // more than 8 buttons or less then 2 buttons will be ignored. When there there isn't an override for a cerain
855
+    // configuration (for example when 3 buttons are displayed) the default jitsi-meet configuration will be used.
856
+    // The order of the buttons in the array is preserved.
857
+    // mainToolbarButtons: [
858
+    //     [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'reactions', 'participants-pane', 'tileview' ],
859
+    //     [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'participants-pane', 'tileview' ],
860
+    //     [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'participants-pane' ],
861
+    //     [ 'microphone', 'camera', 'desktop', 'chat', 'participants-pane' ],
862
+    //     [ 'microphone', 'camera', 'chat', 'participants-pane' ],
863
+    //     [ 'microphone', 'camera', 'chat' ],
864
+    //     [ 'microphone', 'camera' ]
865
+    // ],
866
+
851
     // Toolbar buttons which have their click/tap event exposed through the API on
867
     // Toolbar buttons which have their click/tap event exposed through the API on
852
     // `toolbarButtonClicked`. Passing a string for the button key will
868
     // `toolbarButtonClicked`. Passing a string for the button key will
853
     // prevent execution of the click/tap routine; passing an object with `key` and
869
     // prevent execution of the click/tap routine; passing an object with `key` and

+ 1
- 0
react/features/base/config/configType.ts View File

441
     };
441
     };
442
     localSubject?: string;
442
     localSubject?: string;
443
     locationURL?: URL;
443
     locationURL?: URL;
444
+    mainToolbarButtons?: Array<Array<string>>;
444
     maxFullResolutionParticipants?: number;
445
     maxFullResolutionParticipants?: number;
445
     microsoftApiApplicationClientID?: string;
446
     microsoftApiApplicationClientID?: string;
446
     moderatedRoomServiceUrl?: string;
447
     moderatedRoomServiceUrl?: string;

+ 1
- 0
react/features/base/config/configWhitelist.ts View File

185
     'localRecording',
185
     'localRecording',
186
     'localSubject',
186
     'localSubject',
187
     'logging',
187
     'logging',
188
+    'mainToolbarButtons',
188
     'maxFullResolutionParticipants',
189
     'maxFullResolutionParticipants',
189
     'mouseMoveCallbackInterval',
190
     'mouseMoveCallbackInterval',
190
     'notifications',
191
     'notifications',

+ 10
- 0
react/features/toolbox/actionTypes.ts View File

59
  */
59
  */
60
 export const SET_HANGUP_MENU_VISIBLE = 'SET_HANGUP_MENU_VISIBLE';
60
 export const SET_HANGUP_MENU_VISIBLE = 'SET_HANGUP_MENU_VISIBLE';
61
 
61
 
62
+/**
63
+ * The type of the (redux) action which sets the main toolbar thresholds.
64
+ *
65
+ * {
66
+ *     type: SET_MAIN_TOOLBAR_BUTTONS_THRESHOLDS,
67
+ *     mainToolbarButtonsThresholds: IMainToolbarButtonThresholds
68
+ * }
69
+ */
70
+export const SET_MAIN_TOOLBAR_BUTTONS_THRESHOLDS = 'SET_MAIN_TOOLBAR_BUTTONS_THRESHOLDS';
71
+
62
 /**
72
 /**
63
  * The type of the redux action that toggles whether the overflow menu(s) should be shown as drawers.
73
  * The type of the redux action that toggles whether the overflow menu(s) should be shown as drawers.
64
  */
74
  */

+ 53
- 0
react/features/toolbox/actions.web.ts View File

8
     FULL_SCREEN_CHANGED,
8
     FULL_SCREEN_CHANGED,
9
     SET_FULL_SCREEN,
9
     SET_FULL_SCREEN,
10
     SET_HANGUP_MENU_VISIBLE,
10
     SET_HANGUP_MENU_VISIBLE,
11
+    SET_MAIN_TOOLBAR_BUTTONS_THRESHOLDS,
11
     SET_OVERFLOW_DRAWER,
12
     SET_OVERFLOW_DRAWER,
12
     SET_OVERFLOW_MENU_VISIBLE,
13
     SET_OVERFLOW_MENU_VISIBLE,
13
     SET_TOOLBAR_HOVERED,
14
     SET_TOOLBAR_HOVERED,
14
     SET_TOOLBOX_TIMEOUT
15
     SET_TOOLBOX_TIMEOUT
15
 } from './actionTypes';
16
 } from './actionTypes';
16
 import { setToolboxVisible } from './actions.web';
17
 import { setToolboxVisible } from './actions.web';
18
+import { THRESHOLDS } from './constants';
17
 import { getToolbarTimeout } from './functions.web';
19
 import { getToolbarTimeout } from './functions.web';
20
+import { IMainToolbarButtonThresholds } from './types';
18
 
21
 
19
 export * from './actions.any';
22
 export * from './actions.any';
20
 
23
 
121
     };
124
     };
122
 }
125
 }
123
 
126
 
127
+/**
128
+ * Sets the mainToolbarButtonsThresholds.
129
+ *
130
+ * @returns {Function}
131
+ */
132
+export function setMainToolbarThresholds() {
133
+    return (dispatch: IStore['dispatch'], getState: IStore['getState']) => {
134
+        const { mainToolbarButtons } = getState()['features/base/config'];
135
+
136
+        if (!mainToolbarButtons || !Array.isArray(mainToolbarButtons) || mainToolbarButtons.length === 0) {
137
+            return;
138
+        }
139
+
140
+        const mainToolbarButtonsThresholds: IMainToolbarButtonThresholds = [];
141
+
142
+        const mainToolbarButtonsLenghtMap = new Map();
143
+        let orderIsChanged = false;
144
+
145
+        mainToolbarButtons.forEach(buttons => {
146
+            if (!Array.isArray(buttons) || buttons.length === 0) {
147
+                return;
148
+            }
149
+
150
+            mainToolbarButtonsLenghtMap.set(buttons.length, buttons);
151
+        });
152
+
153
+        THRESHOLDS.forEach(({ width, order }) => {
154
+            let finalOrder = mainToolbarButtonsLenghtMap.get(order.length);
155
+
156
+            if (finalOrder) {
157
+                orderIsChanged = true;
158
+            } else {
159
+                finalOrder = order;
160
+            }
161
+
162
+            mainToolbarButtonsThresholds.push({
163
+                order: finalOrder,
164
+                width
165
+            });
166
+        });
167
+
168
+        if (orderIsChanged) {
169
+            dispatch({
170
+                type: SET_MAIN_TOOLBAR_BUTTONS_THRESHOLDS,
171
+                mainToolbarButtonsThresholds
172
+            });
173
+        }
174
+    };
175
+}
176
+
124
 /**
177
 /**
125
  * Shows the toolbox for specified timeout.
178
  * Shows the toolbox for specified timeout.
126
  *
179
  *

+ 41
- 24
react/features/toolbox/components/web/Toolbox.tsx View File

15
     setToolbarHovered,
15
     setToolbarHovered,
16
     showToolbox
16
     showToolbox
17
 } from '../../actions.web';
17
 } from '../../actions.web';
18
-import { NOT_APPLICABLE, THRESHOLDS } from '../../constants';
18
+import { MAIN_TOOLBAR_BUTTONS_PRIORITY } from '../../constants';
19
 import {
19
 import {
20
     getAllToolboxButtons,
20
     getAllToolboxButtons,
21
     getJwtDisabledButtons,
21
     getJwtDisabledButtons,
23
     isToolboxVisible
23
     isToolboxVisible
24
 } from '../../functions.web';
24
 } from '../../functions.web';
25
 import { useKeyboardShortcuts } from '../../hooks.web';
25
 import { useKeyboardShortcuts } from '../../hooks.web';
26
-import { IToolboxButton, NOTIFY_CLICK_MODE } from '../../types';
26
+import { IToolboxButton, NOTIFY_CLICK_MODE, ToolbarButton } from '../../types';
27
 import HangupButton from '../HangupButton';
27
 import HangupButton from '../HangupButton';
28
 
28
 
29
 import { EndConferenceButton } from './EndConferenceButton';
29
 import { EndConferenceButton } from './EndConferenceButton';
92
      */
92
      */
93
     _jwtDisabledButtons: string[];
93
     _jwtDisabledButtons: string[];
94
 
94
 
95
+    /**
96
+     * The main toolbar buttons thresholds used to determine the visible buttons depending on the current screen size.
97
+     */
98
+    _mainToolbarButtonsThresholds: Array<{
99
+        order: Array<ToolbarButton | string>;
100
+        width: number;
101
+    }>;
102
+
95
     /**
103
     /**
96
      * Whether or not the overflow menu is displayed in a drawer drawer.
104
      * Whether or not the overflow menu is displayed in a drawer drawer.
97
      */
105
      */
174
     _isMobile,
182
     _isMobile,
175
     _isNarrowLayout,
183
     _isNarrowLayout,
176
     _jwtDisabledButtons,
184
     _jwtDisabledButtons,
185
+    _mainToolbarButtonsThresholds,
177
     _overflowDrawer,
186
     _overflowDrawer,
178
     _overflowMenuVisible,
187
     _overflowMenuVisible,
179
     _reactionsButtonEnabled,
188
     _reactionsButtonEnabled,
280
     function getVisibleButtons() {
289
     function getVisibleButtons() {
281
         const buttons = getAllToolboxButtons(_customToolbarButtons);
290
         const buttons = getAllToolboxButtons(_customToolbarButtons);
282
 
291
 
292
+        const filteredButtons = Object.keys(buttons).filter(key =>
293
+            typeof key !== 'undefined' // filter invalid buttons that may be comming from config.mainToolbarButtons
294
+            // override
295
+            && !_jwtDisabledButtons.includes(key)
296
+            && isButtonEnabled(key, _toolbarButtons));
297
+
283
         setButtonsNotifyClickMode(buttons);
298
         setButtonsNotifyClickMode(buttons);
284
-        const isHangupVisible = isButtonEnabled('hangup', _toolbarButtons);
285
-        const { order } = THRESHOLDS.find(({ width }) => _clientWidth > width)
286
-            || THRESHOLDS[THRESHOLDS.length - 1];
287
-
288
-        const keys = Object.keys(buttons);
289
-
290
-        const filtered = [
291
-            ...order.map(key => buttons[key as keyof typeof buttons]),
292
-            ...Object.values(buttons).filter((button, index) => !order.includes(keys[index]))
293
-        ].filter(({ key, alias = NOT_APPLICABLE }) =>
294
-            !_jwtDisabledButtons.includes(key)
295
-            && (isButtonEnabled(key, _toolbarButtons) || isButtonEnabled(alias, _toolbarButtons))
296
-        );
299
+        const { order } = _mainToolbarButtonsThresholds.find(({ width }) => _clientWidth > width)
300
+            || _mainToolbarButtonsThresholds[_mainToolbarButtonsThresholds.length - 1];
301
+
302
+        const mainToolbarButtonKeysOrder = [
303
+            ...order.filter(key => filteredButtons.includes(key)),
304
+            ...MAIN_TOOLBAR_BUTTONS_PRIORITY.filter(key => !order.includes(key) && filteredButtons.includes(key)),
305
+            ...filteredButtons.filter(key => !order.includes(key) && !MAIN_TOOLBAR_BUTTONS_PRIORITY.includes(key))
306
+        ];
307
+
308
+        const mainButtonsKeys = mainToolbarButtonKeysOrder.slice(0, order.length);
309
+        const overflowMenuButtons = filteredButtons.reduce((acc, key) => {
310
+            if (!mainButtonsKeys.includes(key)) {
311
+                acc.push(buttons[key]);
312
+            }
297
 
313
 
298
-        let sliceIndex = _overflowDrawer || _reactionsButtonEnabled ? order.length + 2 : order.length + 1;
314
+            return acc;
315
+        }, [] as IToolboxButton[]);
299
 
316
 
300
-        if (isHangupVisible) {
301
-            sliceIndex -= 1;
302
-        }
317
+        // if we have 1 button in the overflow menu it is better to directly display it in the main toolbar by replacing
318
+        // the "More" menu button with it.
319
+        if (overflowMenuButtons.length === 1) {
320
+            const button = overflowMenuButtons.shift()?.key;
303
 
321
 
304
-        // This implies that the overflow button will be displayed, so save some space for it.
305
-        if (sliceIndex < filtered.length) {
306
-            sliceIndex -= 1;
322
+            button && mainButtonsKeys.push(button);
307
         }
323
         }
308
 
324
 
309
         return {
325
         return {
310
-            mainMenuButtons: filtered.slice(0, sliceIndex),
311
-            overflowMenuButtons: filtered.slice(sliceIndex)
326
+            mainMenuButtons: mainButtonsKeys.map(key => buttons[key]),
327
+            overflowMenuButtons
312
         };
328
         };
313
     }
329
     }
314
 
330
 
505
         _jwtDisabledButtons: getJwtDisabledButtons(state),
521
         _jwtDisabledButtons: getJwtDisabledButtons(state),
506
         _hangupMenuVisible: hangupMenuVisible,
522
         _hangupMenuVisible: hangupMenuVisible,
507
         _isNarrowLayout: isNarrowLayout,
523
         _isNarrowLayout: isNarrowLayout,
524
+        _mainToolbarButtonsThresholds: state['features/toolbox'].mainToolbarButtonsThresholds,
508
         _overflowMenuVisible: overflowMenuVisible,
525
         _overflowMenuVisible: overflowMenuVisible,
509
         _overflowDrawer: overflowDrawer,
526
         _overflowDrawer: overflowDrawer,
510
         _reactionsButtonEnabled: isReactionsButtonEnabled(state),
527
         _reactionsButtonEnabled: isReactionsButtonEnabled(state),

+ 42
- 6
react/features/toolbox/constants.ts View File

6
 export const THRESHOLDS = [
6
 export const THRESHOLDS = [
7
     {
7
     {
8
         width: 565,
8
         width: 565,
9
-        order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'reactions', 'participants', 'tileview' ]
9
+        order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'reactions', 'participants-pane', 'tileview' ]
10
     },
10
     },
11
     {
11
     {
12
         width: 520,
12
         width: 520,
13
-        order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'participants', 'tileview' ]
13
+        order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'participants-pane', 'tileview' ]
14
     },
14
     },
15
     {
15
     {
16
         width: 470,
16
         width: 470,
17
-        order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'participants' ]
17
+        order: [ 'microphone', 'camera', 'desktop', 'chat', 'raisehand', 'participants-pane' ]
18
     },
18
     },
19
     {
19
     {
20
         width: 420,
20
         width: 420,
21
-        order: [ 'microphone', 'camera', 'desktop', 'chat', 'participants' ]
21
+        order: [ 'microphone', 'camera', 'desktop', 'chat', 'participants-pane' ]
22
     },
22
     },
23
     {
23
     {
24
         width: 370,
24
         width: 370,
25
-        order: [ 'microphone', 'camera', 'chat', 'participants' ]
25
+        order: [ 'microphone', 'camera', 'chat', 'participants-pane' ]
26
     },
26
     },
27
     {
27
     {
28
         width: 225,
28
         width: 225,
34
     }
34
     }
35
 ];
35
 ];
36
 
36
 
37
-export const NOT_APPLICABLE = 'N/A';
37
+/**
38
+ * Main toolbar buttons priority used to determine which button should be picked to fill empty spaces for disabled
39
+ * buttons.
40
+ */
41
+export const MAIN_TOOLBAR_BUTTONS_PRIORITY = [
42
+    'microphone',
43
+    'camera',
44
+    'desktop',
45
+    'chat',
46
+    'raisehand',
47
+    'reactions',
48
+    'participants-pane',
49
+    'tileview',
50
+    'invite',
51
+    'toggle-camera',
52
+    'videoquality',
53
+    'fullscreen',
54
+    'security',
55
+    'closedcaptions',
56
+    'recording',
57
+    'livestreaming',
58
+    'linktosalesforce',
59
+    'sharedvideo',
60
+    'shareaudio',
61
+    'noisesuppression',
62
+    'whiteboard',
63
+    'etherpad',
64
+    'select-background',
65
+    'stats',
66
+    'settings',
67
+    'shortcuts',
68
+    'profile',
69
+    'embedmeeting',
70
+    'feedback',
71
+    'download',
72
+    'help'
73
+];
38
 
74
 
39
 export const TOOLBAR_TIMEOUT = 4000;
75
 export const TOOLBAR_TIMEOUT = 4000;
40
 
76
 

+ 19
- 20
react/features/toolbox/functions.web.ts View File

271
         group: 2
271
         group: 2
272
     };
272
     };
273
 
273
 
274
-    const videoQuality = {
274
+    const videoquality = {
275
         key: 'videoquality',
275
         key: 'videoquality',
276
         Content: VideoQualityButton,
276
         Content: VideoQualityButton,
277
         group: 2
277
         group: 2
285
 
285
 
286
     const security = {
286
     const security = {
287
         key: 'security',
287
         key: 'security',
288
-        alias: 'info',
289
         Content: SecurityDialogButton,
288
         Content: SecurityDialogButton,
290
         group: 2
289
         group: 2
291
     };
290
     };
292
 
291
 
293
-    const cc = {
292
+    const closedcaptions = {
294
         key: 'closedcaptions',
293
         key: 'closedcaptions',
295
         Content: ClosedCaptionButton,
294
         Content: ClosedCaptionButton,
296
         group: 2
295
         group: 2
308
         group: 2
307
         group: 2
309
     };
308
     };
310
 
309
 
311
-    const linkToSalesforce = {
310
+    const linktosalesforce = {
312
         key: 'linktosalesforce',
311
         key: 'linktosalesforce',
313
         Content: LinkToSalesforceButton,
312
         Content: LinkToSalesforceButton,
314
         group: 2
313
         group: 2
315
     };
314
     };
316
 
315
 
317
-    const shareVideo = {
316
+    const sharedvideo = {
318
         key: 'sharedvideo',
317
         key: 'sharedvideo',
319
         Content: SharedVideoButton,
318
         Content: SharedVideoButton,
320
         group: 3
319
         group: 3
321
     };
320
     };
322
 
321
 
323
-    const shareAudio = {
322
+    const shareaudio = {
324
         key: 'shareaudio',
323
         key: 'shareaudio',
325
         Content: ShareAudioButton,
324
         Content: ShareAudioButton,
326
         group: 3
325
         group: 3
327
     };
326
     };
328
 
327
 
329
-    const noiseSuppression = {
328
+    const noisesuppression = {
330
         key: 'noisesuppression',
329
         key: 'noisesuppression',
331
         Content: NoiseSuppressionButton,
330
         Content: NoiseSuppressionButton,
332
         group: 3
331
         group: 3
351
         group: 3
350
         group: 3
352
     };
351
     };
353
 
352
 
354
-    const speakerStats = {
353
+    const stats = {
355
         key: 'stats',
354
         key: 'stats',
356
         Content: SpeakerStatsButton,
355
         Content: SpeakerStatsButton,
357
         group: 3
356
         group: 3
369
         group: 4
368
         group: 4
370
     };
369
     };
371
 
370
 
372
-    const embed = {
371
+    const embedmeeting = {
373
         key: 'embedmeeting',
372
         key: 'embedmeeting',
374
         Content: EmbedMeetingButton,
373
         Content: EmbedMeetingButton,
375
         group: 4
374
         group: 4
415
         chat,
414
         chat,
416
         raisehand,
415
         raisehand,
417
         reactions,
416
         reactions,
418
-        participants,
417
+        'participants-pane': participants,
419
         invite,
418
         invite,
420
         tileview,
419
         tileview,
421
-        toggleCamera,
422
-        videoQuality,
420
+        'toggle-camera': toggleCamera,
421
+        videoquality,
423
         fullscreen,
422
         fullscreen,
424
         security,
423
         security,
425
-        cc,
424
+        closedcaptions,
426
         recording,
425
         recording,
427
         livestreaming,
426
         livestreaming,
428
-        linkToSalesforce,
429
-        shareVideo,
430
-        shareAudio,
431
-        noiseSuppression,
427
+        linktosalesforce,
428
+        sharedvideo,
429
+        shareaudio,
430
+        noisesuppression,
432
         whiteboard,
431
         whiteboard,
433
         etherpad,
432
         etherpad,
434
-        virtualBackground,
435
-        speakerStats,
433
+        'select-background': virtualBackground,
434
+        stats,
436
         settings,
435
         settings,
437
         shortcuts,
436
         shortcuts,
438
-        embed,
437
+        embedmeeting,
439
         feedback,
438
         feedback,
440
         download,
439
         download,
441
         help,
440
         help,

+ 4
- 0
react/features/toolbox/middleware.web.ts View File

16
     SET_TOOLBAR_BUTTONS,
16
     SET_TOOLBAR_BUTTONS,
17
     SET_TOOLBOX_TIMEOUT
17
     SET_TOOLBOX_TIMEOUT
18
 } from './actionTypes';
18
 } from './actionTypes';
19
+import { setMainToolbarThresholds } from './actions.web';
19
 import { TOOLBAR_BUTTONS, VISITORS_MODE_BUTTONS } from './constants';
20
 import { TOOLBAR_BUTTONS, VISITORS_MODE_BUTTONS } from './constants';
20
 import { NOTIFY_CLICK_MODE } from './types';
21
 import { NOTIFY_CLICK_MODE } from './types';
21
 
22
 
53
             } = state['features/base/config'];
54
             } = state['features/base/config'];
54
 
55
 
55
             batch(() => {
56
             batch(() => {
57
+                if (action.type !== I_AM_VISITOR_MODE) {
58
+                    dispatch(setMainToolbarThresholds());
59
+                }
56
                 dispatch({
60
                 dispatch({
57
                     type: SET_BUTTONS_WITH_NOTIFY_CLICK,
61
                     type: SET_BUTTONS_WITH_NOTIFY_CLICK,
58
                     buttonsWithNotifyClick: _buildButtonsArray(buttonsWithNotifyClick, customToolbarButtons)
62
                     buttonsWithNotifyClick: _buildButtonsArray(buttonsWithNotifyClick, customToolbarButtons)

+ 15
- 1
react/features/toolbox/reducer.ts View File

6
     FULL_SCREEN_CHANGED,
6
     FULL_SCREEN_CHANGED,
7
     SET_BUTTONS_WITH_NOTIFY_CLICK,
7
     SET_BUTTONS_WITH_NOTIFY_CLICK,
8
     SET_HANGUP_MENU_VISIBLE,
8
     SET_HANGUP_MENU_VISIBLE,
9
+    SET_MAIN_TOOLBAR_BUTTONS_THRESHOLDS,
9
     SET_OVERFLOW_DRAWER,
10
     SET_OVERFLOW_DRAWER,
10
     SET_OVERFLOW_MENU_VISIBLE,
11
     SET_OVERFLOW_MENU_VISIBLE,
11
     SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK,
12
     SET_PARTICIPANT_MENU_BUTTONS_WITH_NOTIFY_CLICK,
17
     SET_TOOLBOX_VISIBLE,
18
     SET_TOOLBOX_VISIBLE,
18
     TOGGLE_TOOLBOX_VISIBLE
19
     TOGGLE_TOOLBOX_VISIBLE
19
 } from './actionTypes';
20
 } from './actionTypes';
20
-import { NOTIFY_CLICK_MODE } from './types';
21
+import { THRESHOLDS } from './constants';
22
+import { IMainToolbarButtonThresholds, NOTIFY_CLICK_MODE } from './types';
21
 
23
 
22
 /**
24
 /**
23
  * Initial state of toolbox's part of Redux store.
25
  * Initial state of toolbox's part of Redux store.
47
      */
49
      */
48
     hovered: false,
50
     hovered: false,
49
 
51
 
52
+    /**
53
+     * The thresholds for screen size and visible main toolbar buttons.
54
+     */
55
+    mainToolbarButtonsThresholds: THRESHOLDS,
56
+
50
     participantMenuButtonsWithNotifyClick: new Map(),
57
     participantMenuButtonsWithNotifyClick: new Map(),
51
 
58
 
52
     /**
59
     /**
98
     fullScreen?: boolean;
105
     fullScreen?: boolean;
99
     hangupMenuVisible: boolean;
106
     hangupMenuVisible: boolean;
100
     hovered: boolean;
107
     hovered: boolean;
108
+    mainToolbarButtonsThresholds: IMainToolbarButtonThresholds;
101
     overflowDrawer: boolean;
109
     overflowDrawer: boolean;
102
     overflowMenuVisible: boolean;
110
     overflowMenuVisible: boolean;
103
     participantMenuButtonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>;
111
     participantMenuButtonsWithNotifyClick: Map<string, NOTIFY_CLICK_MODE>;
151
                 ...state,
159
                 ...state,
152
                 buttonsWithNotifyClick: action.buttonsWithNotifyClick
160
                 buttonsWithNotifyClick: action.buttonsWithNotifyClick
153
             };
161
             };
162
+
163
+        case SET_MAIN_TOOLBAR_BUTTONS_THRESHOLDS:
164
+            return {
165
+                ...state,
166
+                mainToolbarButtonsThresholds: action.mainToolbarButtonsThresholds
167
+            };
154
         case SET_TOOLBAR_HOVERED:
168
         case SET_TOOLBAR_HOVERED:
155
             return {
169
             return {
156
                 ...state,
170
                 ...state,

+ 5
- 1
react/features/toolbox/types.ts View File

2
 
2
 
3
 export interface IToolboxButton {
3
 export interface IToolboxButton {
4
     Content: ComponentType<any>;
4
     Content: ComponentType<any>;
5
-    alias?: string;
6
     group: number;
5
     group: number;
7
     key: string;
6
     key: string;
8
 }
7
 }
49
     ONLY_NOTIFY = 'ONLY_NOTIFY',
48
     ONLY_NOTIFY = 'ONLY_NOTIFY',
50
     PREVENT_AND_NOTIFY = 'PREVENT_AND_NOTIFY'
49
     PREVENT_AND_NOTIFY = 'PREVENT_AND_NOTIFY'
51
 }
50
 }
51
+
52
+export type IMainToolbarButtonThresholds = Array<{
53
+    order: Array<ToolbarButton | string>;
54
+    width: number;
55
+}>;

Loading…
Cancel
Save