rn,thumbnail: introduce screen-sharing indicator

This commit is contained in:
Saúl Ibarra Corretgé 2020-07-16 17:03:15 +02:00 committed by Saúl Ibarra Corretgé
parent 5e3bd746e9
commit 4807badac8
3 changed files with 23 additions and 10 deletions

View File

@ -2,7 +2,6 @@
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { IconShareDesktop } from '../../icons';
import { getParticipantById } from '../../participants'; import { getParticipantById } from '../../participants';
import { connect } from '../../redux'; import { connect } from '../../redux';
import { getAvatarColor, getInitials } from '../functions'; import { getAvatarColor, getInitials } from '../functions';
@ -192,17 +191,10 @@ export function _mapStateToProps(state: Object, ownProps: Props) {
const { colorBase, displayName, participantId } = ownProps; const { colorBase, displayName, participantId } = ownProps;
const _participant: ?Object = participantId && getParticipantById(state, participantId); const _participant: ?Object = participantId && getParticipantById(state, participantId);
const _initialsBase = _participant?.name ?? displayName; const _initialsBase = _participant?.name ?? displayName;
const screenShares = state['features/video-layout'].screenShares || [];
let _loadableAvatarUrl = _participant?.loadableAvatarUrl;
if (participantId && screenShares.includes(participantId)) {
_loadableAvatarUrl = IconShareDesktop;
}
return { return {
_initialsBase, _initialsBase,
_loadableAvatarUrl, _loadableAvatarUrl: _participant?.loadableAvatarUrl,
colorBase: !colorBase && _participant ? _participant.id : colorBase colorBase: !colorBase && _participant ? _participant.id : colorBase
}; };
} }

View File

@ -0,0 +1,19 @@
// @flow
import React from 'react';
import { IconShareDesktop } from '../../../base/icons';
import { BaseIndicator } from '../../../base/react';
/**
* Thumbnail badge for displaying if a participant is sharing their screen.
*
* @returns {React$Element<any>}
*/
export default function ScreenShareIndicator() {
return (
<BaseIndicator
highlight = { false }
icon = { IconShareDesktop } />
);
}

View File

@ -27,6 +27,7 @@ import AudioMutedIndicator from './AudioMutedIndicator';
import DominantSpeakerIndicator from './DominantSpeakerIndicator'; import DominantSpeakerIndicator from './DominantSpeakerIndicator';
import ModeratorIndicator from './ModeratorIndicator'; import ModeratorIndicator from './ModeratorIndicator';
import RaisedHandIndicator from './RaisedHandIndicator'; import RaisedHandIndicator from './RaisedHandIndicator';
import ScreenShareIndicator from './ScreenShareIndicator';
import VideoMutedIndicator from './VideoMutedIndicator'; import VideoMutedIndicator from './VideoMutedIndicator';
import styles, { AVATAR_SIZE } from './styles'; import styles, { AVATAR_SIZE } from './styles';
@ -186,9 +187,10 @@ function Thumbnail(props: Props) {
{ !participant.isFakeParticipant && <Container style = { styles.thumbnailIndicatorContainer }> { !participant.isFakeParticipant && <Container style = { styles.thumbnailIndicatorContainer }>
{ audioMuted { audioMuted
&& <AudioMutedIndicator /> } && <AudioMutedIndicator /> }
{ videoMuted { videoMuted
&& <VideoMutedIndicator /> } && <VideoMutedIndicator /> }
{ isScreenShare
&& <ScreenShareIndicator /> }
</Container> } </Container> }
</Container> </Container>