2019-03-12 17:45:53 +00:00
|
|
|
/* @flow */
|
|
|
|
|
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
2019-11-06 12:13:00 +00:00
|
|
|
import { getConferenceName } from '../../../base/conference/functions';
|
2019-11-19 07:59:10 +00:00
|
|
|
import { getParticipantCount } from '../../../base/participants/functions';
|
2019-03-21 16:38:29 +00:00
|
|
|
import { connect } from '../../../base/redux';
|
2020-07-24 12:14:33 +00:00
|
|
|
import { isToolboxVisible } from '../../../toolbox/functions.web';
|
2020-01-13 17:12:25 +00:00
|
|
|
import ConferenceTimer from '../ConferenceTimer';
|
2020-05-20 10:57:03 +00:00
|
|
|
|
2019-10-31 06:14:15 +00:00
|
|
|
import ParticipantsCount from './ParticipantsCount';
|
|
|
|
|
2019-03-12 17:45:53 +00:00
|
|
|
/**
|
|
|
|
* The type of the React {@code Component} props of {@link Subject}.
|
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
2019-11-19 07:59:10 +00:00
|
|
|
/**
|
2020-12-03 21:49:08 +00:00
|
|
|
* Whether the conference timer should be shown or not.
|
|
|
|
*/
|
|
|
|
_hideConferenceTimer: Boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether the participant count should be shown or not.
|
2019-11-19 07:59:10 +00:00
|
|
|
*/
|
|
|
|
_showParticipantCount: boolean,
|
|
|
|
|
2021-01-07 13:31:53 +00:00
|
|
|
/**
|
|
|
|
* Whether the conference subject should be shown or not.
|
|
|
|
*/
|
|
|
|
_showSubject: boolean,
|
|
|
|
|
2019-03-12 17:45:53 +00:00
|
|
|
/**
|
2019-11-06 12:13:00 +00:00
|
|
|
* The subject or the of the conference.
|
|
|
|
* Falls back to conference name.
|
2019-03-12 17:45:53 +00:00
|
|
|
*/
|
|
|
|
_subject: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Indicates whether the component should be visible or not.
|
|
|
|
*/
|
|
|
|
_visible: boolean
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Subject react component.
|
|
|
|
*
|
|
|
|
* @class Subject
|
|
|
|
*/
|
|
|
|
class Subject extends Component<Props> {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implements React's {@link Component#render()}.
|
|
|
|
*
|
|
|
|
* @inheritdoc
|
|
|
|
* @returns {ReactElement}
|
|
|
|
*/
|
|
|
|
render() {
|
2021-01-07 13:31:53 +00:00
|
|
|
const { _hideConferenceTimer, _showParticipantCount, _showSubject, _subject, _visible } = this.props;
|
2021-01-15 13:45:07 +00:00
|
|
|
let className = `subject ${_visible ? 'visible' : ''}`;
|
|
|
|
|
|
|
|
if (!_hideConferenceTimer || _showParticipantCount || _showSubject) {
|
|
|
|
className += ' gradient';
|
|
|
|
}
|
2019-03-12 17:45:53 +00:00
|
|
|
|
|
|
|
return (
|
2021-01-15 13:45:07 +00:00
|
|
|
<div className = { className }>
|
2021-01-07 13:31:53 +00:00
|
|
|
{ _showSubject && <span className = 'subject-text'>{ _subject }</span>}
|
2019-11-19 07:59:10 +00:00
|
|
|
{ _showParticipantCount && <ParticipantsCount /> }
|
2020-12-03 21:49:08 +00:00
|
|
|
{ !_hideConferenceTimer && <ConferenceTimer /> }
|
2019-03-12 17:45:53 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps (parts of) the Redux state to the associated
|
|
|
|
* {@code Subject}'s props.
|
|
|
|
*
|
|
|
|
* @param {Object} state - The Redux state.
|
|
|
|
* @private
|
|
|
|
* @returns {{
|
2020-12-03 21:49:08 +00:00
|
|
|
* _hideConferenceTimer: boolean,
|
|
|
|
* _showParticipantCount: boolean,
|
2021-01-07 13:31:53 +00:00
|
|
|
* _showSubject: boolean,
|
2019-03-12 17:45:53 +00:00
|
|
|
* _subject: string,
|
|
|
|
* _visible: boolean
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
function _mapStateToProps(state) {
|
2019-11-19 07:59:10 +00:00
|
|
|
const participantCount = getParticipantCount(state);
|
2021-01-07 13:31:53 +00:00
|
|
|
const { hideConferenceTimer, hideConferenceSubject, hideParticipantsStats } = state['features/base/config'];
|
2019-03-12 17:45:53 +00:00
|
|
|
|
|
|
|
return {
|
2021-01-07 13:31:53 +00:00
|
|
|
_hideConferenceTimer: Boolean(hideConferenceTimer),
|
|
|
|
_showParticipantCount: participantCount > 2 && !hideParticipantsStats,
|
|
|
|
_showSubject: !hideConferenceSubject,
|
2019-11-06 12:13:00 +00:00
|
|
|
_subject: getConferenceName(state),
|
2020-04-01 07:47:51 +00:00
|
|
|
_visible: isToolboxVisible(state) && participantCount > 1
|
2019-03-12 17:45:53 +00:00
|
|
|
};
|
|
|
|
}
|
2019-03-19 15:42:25 +00:00
|
|
|
|
2019-03-12 17:45:53 +00:00
|
|
|
export default connect(_mapStateToProps)(Subject);
|