Skip to content

Commit

Permalink
feat(conference-info-header) Make conference info header configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
horymury committed Aug 6, 2021
1 parent 1433a1e commit ef87d66
Show file tree
Hide file tree
Showing 13 changed files with 393 additions and 183 deletions.
23 changes: 20 additions & 3 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,15 +762,32 @@ var config = {
// If true, tile view will not be enabled automatically when the participants count threshold is reached.
// disableTileView: true,

// Controls the visibility and behavior of the top header conference info labels.
// If a label's id is not in any of the 2 arrays, it will not be visible at all on the header.
// conferenceInfo: {
// // those labels will not be hidden in tandem with the toolbox.
// alwaysVisible: ['recording', 'local-recording'],
// // those labels will be auto-hidden in tandem with the toolbox buttons.
// autoHide: [
// 'subject',
// 'conference-timer',
// 'participants-count',
// 'e2ee',
// 'transcribing',
// 'video-quality',
// 'insecure-room'
// ]
// },

// Hides the conference subject
// hideConferenceSubject: true,

// Hides the recording label
// hideRecordingLabel: false,

// Hides the conference timer.
// hideConferenceTimer: true,

// Hides the recording label
// hideRecordingLabel: false,

// Hides the participants stats
// hideParticipantsStats: true,

Expand Down
84 changes: 39 additions & 45 deletions css/_subject.scss
Original file line number Diff line number Diff line change
@@ -1,54 +1,22 @@
.subject {
box-sizing: border-box;
color: #fff;
margin-top: 20px;
position: absolute;
top: -120px;
transition: top .3s ease-in;
width: 100%;
margin-top: -120px;
transition: margin-top .3s ease-in;
z-index: $zindex3;

&.visible {
top: 0;
}

&.recording {
top: 0;

.subject-details-container {
opacity: 0;
transition: opacity .3s ease-in;
}

.subject-info-container .show-always {
transition: margin-left .3s ease-in;
}

&.visible {
.subject-details-container {
opacity: 1;
}
}
margin-top: 20px;
}
}

.subject-details-container {
display: flex;
}

.subject-info-container {
display: flex;
justify-content: center;
max-width: calc(100% - 280px);
margin: 0 auto;

&--full-width {
max-width: 100%;
}
height: 28px;

@media (max-width: 500px) {
flex-wrap: wrap;
max-width: 100%;
}
}

Expand All @@ -63,21 +31,47 @@
.subject-text {
background: rgba(0, 0, 0, 0.6);
border-radius: 3px 0px 0px 3px;
box-sizing: border-box;
font-size: 14px;
line-height: 24px;
padding: 2px 16px;
height: 24px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 28px;
padding: 0 16px;
height: 28px;

@media (max-width: 700px) {
max-width: 100px;
}

@media (max-width: 300px) {
display: none;
}

&--content {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}

.subject-timer {
background: rgba(0, 0, 0, 0.8);
border-radius: 0px 3px 3px 0px;
display: inline-block;
box-sizing: border-box;
font-size: 12px;
line-height: 16px;
line-height: 28px;
min-width: 34px;
padding: 6px 8px;
padding: 0 8px;
height: 28px;

@media (max-width: 300px) {
display: none;
}
}

.details-container {
width: 100%;
display: flex;
justify-content: center;
position: absolute;
top: 0;
height: 48px;
}
1 change: 1 addition & 0 deletions react/features/base/config/configWhitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default [
*/
'callUUID',

'conferenceInfo',
'channelLastN',
'constraints',
'brandingRoomAlias',
Expand Down
62 changes: 62 additions & 0 deletions react/features/base/config/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import _ from 'lodash';

import { CONFERENCE_INFO } from '../../conference/components/constants';
import { equals, ReducerRegistry } from '../redux';

import {
Expand Down Expand Up @@ -172,6 +173,27 @@ function _setConfig(state, { config }) {
return equals(state, newState) ? state : newState;
}

/**
* Processes the conferenceInfo object against the defaults.
*
* @param {Object} config - The old config.
* @returns {Object} The processed conferenceInfo object.
*/
function _getConferenceInfo(config) {
const { conferenceInfo } = config;

if (conferenceInfo) {
return {
alwaysVisible: conferenceInfo.alwaysVisible ?? [ ...CONFERENCE_INFO.alwaysVisible ],
autoHide: conferenceInfo.autoHide ?? [ ...CONFERENCE_INFO.autoHide ]
};
}

return {
...CONFERENCE_INFO
};
}

/**
* Constructs a new config {@code Object}, if necessary, out of a specific
* config {@code Object} which is in the latest format supported by jitsi-meet.
Expand All @@ -194,6 +216,46 @@ function _translateLegacyConfig(oldValue: Object) {
newValue.toolbarButtons = interfaceConfig.TOOLBAR_BUTTONS;
}

const {
hideConferenceTimer,
hideConferenceSubject,
hideParticipantsStats,
hideRecordingLabel
} = oldValue;

if (hideConferenceTimer || hideConferenceSubject || hideParticipantsStats || hideRecordingLabel) {
newValue.conferenceInfo = _getConferenceInfo(oldValue);

if (hideConferenceTimer) {
newValue.conferenceInfo.alwaysVisible
= newValue.conferenceInfo.alwaysVisible.filter(c => c !== 'conference-timer');
newValue.conferenceInfo.autoHide
= newValue.conferenceInfo.autoHide.filter(c => c !== 'conference-timer');
}
if (hideConferenceSubject) {
newValue.conferenceInfo.alwaysVisible
= newValue.conferenceInfo.alwaysVisible.filter(c => c !== 'subject');
newValue.conferenceInfo.autoHide
= newValue.conferenceInfo.autoHide.filter(c => c !== 'subject');
}
if (hideParticipantsStats) {
newValue.conferenceInfo.alwaysVisible
= newValue.conferenceInfo.alwaysVisible.filter(c => c !== 'participants-count');
newValue.conferenceInfo.autoHide
= newValue.conferenceInfo.autoHide.filter(c => c !== 'participants-count');
}

// hideRecordingLabel does not mean not render it at all, but autoHide it
if (hideRecordingLabel) {
const recValues = [ 'recording', 'local-recording' ];

newValue.conferenceInfo.alwaysVisible
= newValue.conferenceInfo.alwaysVisible.filter(c => !recValues.includes(c));
newValue.conferenceInfo.autoHide
= _.union(newValue.conferenceInfo.autoHide, recValues);
}
}

if (oldValue.stereo || oldValue.opusMaxAverageBitrate) {
newValue.audioQuality = {
opusMaxAverageBitrate: oldValue.audioQuality?.opusMaxAverageBitrate ?? oldValue.opusMaxAverageBitrate,
Expand Down
12 changes: 12 additions & 0 deletions react/features/conference/components/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const CONFERENCE_INFO = {
alwaysVisible: [ 'recording', 'local-recording' ],
autoHide: [
'subject',
'conference-timer',
'participants-count',
'e2ee',
'transcribing',
'video-quality',
'insecure-room'
]
};
22 changes: 22 additions & 0 deletions react/features/conference/components/functions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// @flow

import { CONFERENCE_INFO } from './constants';

/**
* Retrieves the conference info labels based on config values and defaults.
*
* @param {Object} state - The redux state.
* @returns {Object} The conferenceInfo object.
*/
export const getConferenceInfo = (state: Object) => {
const { conferenceInfo } = state['features/base/config'];

if (conferenceInfo) {
return {
alwaysVisible: conferenceInfo.alwaysVisible ?? CONFERENCE_INFO.alwaysVisible,
autoHide: conferenceInfo.autoHide ?? CONFERENCE_INFO.autoHide
};
}

return CONFERENCE_INFO;
};
Loading

0 comments on commit ef87d66

Please sign in to comment.