thumbnail: use a more explicit prop

This commit is contained in:
Saúl Ibarra Corretgé 2019-09-13 11:51:49 +02:00 committed by Saúl Ibarra Corretgé
parent c1f7bf75c1
commit 1b27e331da
1 changed files with 17 additions and 14 deletions

View File

@ -40,11 +40,6 @@ type Props = {
*/ */
_audioTrack: Object, _audioTrack: Object,
/**
* True if everone in the meeting is moderator.
*/
_isEveryoneModerator: boolean,
/** /**
* The Redux representation of the state "features/large-video". * The Redux representation of the state "features/large-video".
*/ */
@ -63,7 +58,12 @@ type Props = {
/** /**
* Whether to show the dominant speaker indicator or not. * Whether to show the dominant speaker indicator or not.
*/ */
_showDominantSpeakerIndicator: boolean, _renderDominantSpeakerIndicator: boolean,
/**
* Whether to show the moderator indicator or not.
*/
_renderModeratorIndicator: boolean,
/** /**
* The color-schemed stylesheet of the feature. * The color-schemed stylesheet of the feature.
@ -123,11 +123,11 @@ class Thumbnail extends Component<Props> {
render() { render() {
const { const {
_audioTrack: audioTrack, _audioTrack: audioTrack,
_isEveryoneModerator,
_largeVideo: largeVideo, _largeVideo: largeVideo,
_onClick, _onClick,
_onShowRemoteVideoMenu, _onShowRemoteVideoMenu,
_showDominantSpeakerIndicator: showDominantSpeakerIndicator, _renderDominantSpeakerIndicator: renderDominantSpeakerIndicator,
_renderModeratorIndicator: renderModeratorIndicator,
_styles, _styles,
_videoTrack: videoTrack, _videoTrack: videoTrack,
disableTint, disableTint,
@ -178,7 +178,7 @@ class Thumbnail extends Component<Props> {
{ renderDisplayName && <DisplayNameLabel participantId = { participantId } /> } { renderDisplayName && <DisplayNameLabel participantId = { participantId } /> }
{ !_isEveryoneModerator && participant.role === PARTICIPANT_ROLE.MODERATOR { renderModeratorIndicator
&& <View style = { styles.moderatorIndicatorContainer }> && <View style = { styles.moderatorIndicatorContainer }>
<ModeratorIndicator /> <ModeratorIndicator />
</View> } </View> }
@ -189,7 +189,7 @@ class Thumbnail extends Component<Props> {
styles.thumbnailTopLeftIndicatorContainer styles.thumbnailTopLeftIndicatorContainer
] }> ] }>
<RaisedHandIndicator participantId = { participant.id } /> <RaisedHandIndicator participantId = { participant.id } />
{ showDominantSpeakerIndicator && <DominantSpeakerIndicator /> } { renderDominantSpeakerIndicator && <DominantSpeakerIndicator /> }
</View> </View>
<View <View
@ -269,19 +269,22 @@ function _mapStateToProps(state, ownProps) {
// the stage i.e. as a large video. // the stage i.e. as a large video.
const largeVideo = state['features/large-video']; const largeVideo = state['features/large-video'];
const tracks = state['features/base/tracks']; const tracks = state['features/base/tracks'];
const id = ownProps.participant.id; const { participant } = ownProps;
const id = participant.id;
const audioTrack const audioTrack
= getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, id); = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, id);
const videoTrack const videoTrack
= getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, id); = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, id);
const participantCount = getParticipantCount(state); const participantCount = getParticipantCount(state);
const showDominantSpeakerIndicator = ownProps.participant.dominantSpeaker && participantCount > 2; const renderDominantSpeakerIndicator = participant.dominantSpeaker && participantCount > 2;
const _isEveryoneModerator = isEveryoneModerator(state);
const renderModeratorIndicator = !_isEveryoneModerator && participant.role === PARTICIPANT_ROLE.MODERATOR;
return { return {
_audioTrack: audioTrack, _audioTrack: audioTrack,
_isEveryoneModerator: isEveryoneModerator(state),
_largeVideo: largeVideo, _largeVideo: largeVideo,
_showDominantSpeakerIndicator: showDominantSpeakerIndicator, _renderDominantSpeakerIndicator: renderDominantSpeakerIndicator,
_renderModeratorIndicator: renderModeratorIndicator,
_styles: ColorSchemeRegistry.get(state, 'Thumbnail'), _styles: ColorSchemeRegistry.get(state, 'Thumbnail'),
_videoTrack: videoTrack _videoTrack: videoTrack
}; };