From 485c875ee5daca6d3f132caed85468768f41a366 Mon Sep 17 00:00:00 2001 From: bogdandarie <30829167+bogdandarie@users.noreply.github.com> Date: Mon, 17 Oct 2022 23:40:13 +0300 Subject: [PATCH] feat(config) add ability to hide speaker stats --- config.js | 20 +++++++ modules/keyboardshortcut/keyboardshortcut.js | 8 --- react/features/base/config/configType.ts | 5 ++ react/features/base/config/configWhitelist.ts | 1 + react/features/base/config/reducer.ts | 19 +++++++ .../components/web/ParticipantsCount.js | 11 +++- react/features/speaker-stats/functions.js | 14 ++++- .../toolbox/components/native/OverflowMenu.js | 12 ++++- .../toolbox/components/web/Toolbox.tsx | 53 +++++++++++++++++-- 9 files changed, 126 insertions(+), 17 deletions(-) diff --git a/config.js b/config.js index d61461ba7..145f8fa0c 100644 --- a/config.js +++ b/config.js @@ -224,9 +224,29 @@ var config = { // Specifies whether the raised hand will hide when someone becomes a dominant speaker or not // disableRemoveRaisedHandOnFocus: false, + // speakerStats: { + // // Specifies whether the speaker stats is enable or not. + // disabled: false, + + // // Specifies whether there will be a search field in speaker stats or not. + // disableSearch: false, + + // // Specifies whether participants in speaker stats should be ordered or not, and with what priority. + // // 'role', <- Moderators on top. + // // 'name', <- Alphabetically by name. + // // 'hasLeft', <- The ones that have left in the bottom. + // order: [ + // 'role', + // 'name', + // 'hasLeft', + // ], + // }, + + // DEPRECATED. Please use speakerStats.disableSearch instead. // Specifies whether there will be a search field in speaker stats or not // disableSpeakerStatsSearch: false, + // DEPRECATED. Please use speakerStats.order . // Specifies whether participants in speaker stats should be ordered or not, and with what priority // speakerStatsOrder: [ // 'role', <- Moderators on top diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js index 91bfc5462..a5ae76a30 100644 --- a/modules/keyboardshortcut/keyboardshortcut.js +++ b/modules/keyboardshortcut/keyboardshortcut.js @@ -12,7 +12,6 @@ import { toggleDialog } from '../../react/features/base/dialog'; import { clickOnVideo } from '../../react/features/filmstrip/actions'; import { KeyboardShortcutsDialog } from '../../react/features/keyboard-shortcuts'; -import { SpeakerStats } from '../../react/features/speaker-stats'; const logger = Logger.getLogger(__filename); @@ -249,13 +248,6 @@ const KeyboardShortcut = { }); this._addShortcutToHelp('SPACE', 'keyboardShortcuts.pushToTalk'); - this.registerShortcut('T', null, () => { - sendAnalytics(createShortcutEvent('speaker.stats')); - APP.store.dispatch(toggleDialog(SpeakerStats, { - conference: APP.conference - })); - }, 'keyboardShortcuts.showSpeakerStats'); - /** * FIXME: Currently focus keys are directly implemented below in * onkeyup. They should be moved to the SmallVideo instead. diff --git a/react/features/base/config/configType.ts b/react/features/base/config/configType.ts index 92e993e5a..b717c7b56 100644 --- a/react/features/base/config/configType.ts +++ b/react/features/base/config/configType.ts @@ -428,6 +428,11 @@ export interface IConfig { mode?: 'always' | 'recording'; }; serviceUrl?: string; + speakerStats?: { + disableSearch?: boolean; + disabled?: boolean; + order?: Array<'role' | 'name' | 'hasLeft'>; + }; speakerStatsOrder?: Array<'role' | 'name' | 'hasLeft'>; startAudioMuted?: number; startAudioOnly?: boolean; diff --git a/react/features/base/config/configWhitelist.ts b/react/features/base/config/configWhitelist.ts index e1b8ccebf..be27a9c41 100644 --- a/react/features/base/config/configWhitelist.ts +++ b/react/features/base/config/configWhitelist.ts @@ -210,6 +210,7 @@ export default [ 'resolution', 'salesforceUrl', 'screenshotCapture', + 'speakerStats', 'startAudioMuted', 'startAudioOnly', 'startLastN', diff --git a/react/features/base/config/reducer.ts b/react/features/base/config/reducer.ts index a28d31c87..bb7da4fef 100644 --- a/react/features/base/config/reducer.ts +++ b/react/features/base/config/reducer.ts @@ -450,6 +450,25 @@ function _translateLegacyConfig(oldValue: IConfig) { }; } + newValue.speakerStats = newValue.speakerStats || {}; + + if (oldValue.disableSpeakerStatsSearch !== undefined + && newValue.speakerStats.disableSearch === undefined + ) { + newValue.speakerStats = { + ...newValue.speakerStats, + disableSearch: oldValue.disableSpeakerStatsSearch + }; + } + + if (oldValue.speakerStatsOrder !== undefined + && newValue.speakerStats.order === undefined) { + newValue.speakerStats = { + ...newValue.speakerStats, + order: oldValue.speakerStatsOrder + }; + } + return newValue; } diff --git a/react/features/conference/components/web/ParticipantsCount.js b/react/features/conference/components/web/ParticipantsCount.js index 0805af417..f67613bc9 100644 --- a/react/features/conference/components/web/ParticipantsCount.js +++ b/react/features/conference/components/web/ParticipantsCount.js @@ -10,6 +10,7 @@ import { COLORS } from '../../../base/label/constants'; import { getParticipantCount } from '../../../base/participants'; import { connect } from '../../../base/redux'; import { SpeakerStats } from '../../../speaker-stats'; +import { isSpeakerStatsDisabled } from '../../../speaker-stats/functions'; /** @@ -31,6 +32,11 @@ type Props = { * Invoked to open Speaker stats. */ dispatch: Dispatch, + + /** + * Weather or not the speaker stats is disabled. + */ + _isSpeakerStatsDisabled: Boolean, }; /** @@ -83,7 +89,7 @@ class ParticipantsCount extends PureComponent {