[RN] Add display name label to tile view

This commit is contained in:
Bettenbuk Zoltan 2019-04-11 12:04:50 +02:00 committed by Zoltan Bettenbuk
parent 42c85c22a9
commit e5caca9cfd
12 changed files with 52 additions and 14 deletions

View File

@ -17,7 +17,7 @@ import { TestConnectionInfo } from '../../../base/testing';
import { createDesiredLocalTracks } from '../../../base/tracks'; import { createDesiredLocalTracks } from '../../../base/tracks';
import { ConferenceNotification } from '../../../calendar-sync'; import { ConferenceNotification } from '../../../calendar-sync';
import { Chat } from '../../../chat'; import { Chat } from '../../../chat';
import { DisplayNameLabel } from '../../../display-name/components/native'; import { DisplayNameLabel } from '../../../display-name';
import { import {
FILMSTRIP_SIZE, FILMSTRIP_SIZE,
Filmstrip, Filmstrip,
@ -61,6 +61,11 @@ type Props = AbstractProps & {
*/ */
_filmstripVisible: boolean, _filmstripVisible: boolean,
/**
* The ID of the participant currently on stage (if any)
*/
_largeVideoParticipantId: string,
/** /**
* Current conference's full URL. * Current conference's full URL.
* *
@ -236,6 +241,7 @@ class Conference extends AbstractConference<Props, *> {
render() { render() {
const { const {
_connecting, _connecting,
_largeVideoParticipantId,
_reducedUI, _reducedUI,
_shouldDisplayTileView _shouldDisplayTileView
} = this.props; } = this.props;
@ -282,7 +288,7 @@ class Conference extends AbstractConference<Props, *> {
<Captions onPress = { this._onClick } /> <Captions onPress = { this._onClick } />
<DisplayNameLabel /> { _shouldDisplayTileView || <DisplayNameLabel participantId = { _largeVideoParticipantId } /> }
{/* {/*
* The Toolbox is in a stacking layer bellow the Filmstrip. * The Toolbox is in a stacking layer bellow the Filmstrip.
@ -497,6 +503,11 @@ function _mapStateToProps(state) {
*/ */
_filmstripVisible: isFilmstripVisible(state), _filmstripVisible: isFilmstripVisible(state),
/**
* The ID of the participant currently on stage.
*/
_largeVideoParticipantId: state['features/large-video'].participantId,
/** /**
* Current conference's full URL. * Current conference's full URL.
* *

View File

@ -1,3 +1,5 @@
// @flow
export * from './components'; export * from './components';
import './middleware'; import './middleware';

View File

@ -9,7 +9,6 @@ import {
shouldRenderParticipantVideo shouldRenderParticipantVideo
} from '../../../base/participants'; } from '../../../base/participants';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import { shouldDisplayTileView } from '../../../video-layout';
import styles from './styles'; import styles from './styles';
@ -23,7 +22,12 @@ type Props = {
/** /**
* True of the label needs to be rendered. False otherwise. * True of the label needs to be rendered. False otherwise.
*/ */
_render: boolean _render: boolean,
/**
* The ID of the participant to render the label for.
*/
participantId: string
} }
/** /**
@ -54,23 +58,24 @@ class DisplayNameLabel extends Component<Props> {
* Maps part of the Redux state to the props of this component. * Maps part of the Redux state to the props of this component.
* *
* @param {Object} state - The Redux state. * @param {Object} state - The Redux state.
* @param {Props} ownProps - The own props of the component.
* @returns {{ * @returns {{
* }} * }}
*/ */
function _mapStateToProps(state: Object) { function _mapStateToProps(state: Object, ownProps: Props) {
const largeVideoParticipantId = state['features/large-video'].participantId; const { participantId } = ownProps;
const localParticipant = getLocalParticipant(state); const localParticipant = getLocalParticipant(state);
// Currently we only render the display name if it's not the local // Currently we only render the display name if it's not the local
// participant, we're not in tile view and there is no video rendered for // participant and there is no video rendered for
// the on-stage participant. // them.
const _render = localParticipant.id !== largeVideoParticipantId const _render = Boolean(participantId)
&& !shouldDisplayTileView(state) && localParticipant.id !== participantId
&& !shouldRenderParticipantVideo(state, largeVideoParticipantId); && !shouldRenderParticipantVideo(state, participantId);
return { return {
_participantName: _participantName:
getParticipantDisplayName(state, largeVideoParticipantId), getParticipantDisplayName(state, participantId),
_render _render
}; };
} }

View File

@ -1,4 +1,5 @@
// @flow // @flow
export { default as DisplayName } from './DisplayName'; export { default as DisplayName } from './DisplayName';
export { default as DisplayNameLabel } from './DisplayNameLabel';
export { default as DisplayNamePrompt } from './DisplayNamePrompt'; export { default as DisplayNamePrompt } from './DisplayNamePrompt';

View File

@ -1 +1,3 @@
// @flow
export * from './native'; export * from './native';

View File

@ -1 +1,3 @@
// @flow
export * from './web'; export * from './web';

View File

@ -1 +1,3 @@
// @flow
export * from './_'; export * from './_';

View File

@ -17,7 +17,7 @@ import { Container } from '../../../base/react';
import { connect } from '../../../base/redux'; import { connect } from '../../../base/redux';
import { StyleType } from '../../../base/styles'; import { StyleType } from '../../../base/styles';
import { getTrackByMediaTypeAndParticipant } from '../../../base/tracks'; import { getTrackByMediaTypeAndParticipant } from '../../../base/tracks';
import { DisplayNameLabel } from '../../../display-name';
import { RemoteVideoMenu } from '../../../remote-video-menu'; import { RemoteVideoMenu } from '../../../remote-video-menu';
import AudioMutedIndicator from './AudioMutedIndicator'; import AudioMutedIndicator from './AudioMutedIndicator';
@ -90,6 +90,11 @@ type Props = {
*/ */
participant: Object, participant: Object,
/**
* Whether to display or hide the display name of the participant in the thumbnail.
*/
renderDisplayName: ?boolean,
/** /**
* Optional styling to add or override on the Thumbnail component root. * Optional styling to add or override on the Thumbnail component root.
*/ */
@ -119,7 +124,8 @@ class Thumbnail extends Component<Props> {
_videoTrack: videoTrack, _videoTrack: videoTrack,
disablePin, disablePin,
disableTint, disableTint,
participant participant,
renderDisplayName
} = this.props; } = this.props;
// We don't render audio in any of the following: // We don't render audio in any of the following:
@ -163,6 +169,8 @@ class Thumbnail extends Component<Props> {
tintStyle = { _styles.activeThumbnailTint } tintStyle = { _styles.activeThumbnailTint }
zOrder = { 1 } /> zOrder = { 1 } />
{ renderDisplayName && <DisplayNameLabel participantId = { participantId } /> }
{ participant.role === PARTICIPANT_ROLE.MODERATOR { participant.role === PARTICIPANT_ROLE.MODERATOR
&& <View style = { styles.moderatorIndicatorContainer }> && <View style = { styles.moderatorIndicatorContainer }>
<ModeratorIndicator /> <ModeratorIndicator />

View File

@ -302,6 +302,7 @@ class TileView extends Component<Props, State> {
disableTint = { true } disableTint = { true }
key = { participant.id } key = { participant.id }
participant = { participant } participant = { participant }
renderDisplayName = { true }
styleOverrides = { styleOverrides } />)); styleOverrides = { styleOverrides } />));
} }

View File

@ -1,3 +1,5 @@
// @flow
export { default as Filmstrip } from './Filmstrip'; export { default as Filmstrip } from './Filmstrip';
export { default as TileView } from './TileView'; export { default as TileView } from './TileView';
export { default as styles } from './styles'; export { default as styles } from './styles';

View File

@ -1,3 +1,5 @@
// @flow
export { default as AudioMutedIndicator } from './AudioMutedIndicator'; export { default as AudioMutedIndicator } from './AudioMutedIndicator';
export { default as DominantSpeakerIndicator } export { default as DominantSpeakerIndicator }
from './DominantSpeakerIndicator'; from './DominantSpeakerIndicator';