From 59065d10f811279ac1a1ed2bba18157569301b93 Mon Sep 17 00:00:00 2001 From: Robert Pintilii Date: Mon, 14 Feb 2022 12:13:18 +0200 Subject: [PATCH] feat(thumbnails, rn) Native thumbnails redesign (#10954) --- .../react/components/native/BaseIndicator.js | 16 +----- .../components/native/indicatorstyles.js | 11 +--- .../components/native/ConnectionIndicator.js | 26 ++++----- .../components/native/styles.js | 4 ++ .../components/native/DisplayNameLabel.js | 18 +++--- .../display-name/components/native/styles.js | 7 ++- .../components/native/AudioMutedIndicator.js | 4 +- .../native/DominantSpeakerIndicator.js | 25 -------- .../components/native/ModeratorIndicator.js | 6 +- .../components/native/RaisedHandIndicator.js | 15 ++--- .../components/native/ScreenShareIndicator.js | 4 +- .../filmstrip/components/native/Thumbnail.js | 55 +++++------------- .../components/native/VideoMutedIndicator.js | 24 -------- .../filmstrip/components/native/styles.js | 57 ++++++++++--------- 14 files changed, 95 insertions(+), 177 deletions(-) delete mode 100644 react/features/filmstrip/components/native/DominantSpeakerIndicator.js delete mode 100644 react/features/filmstrip/components/native/VideoMutedIndicator.js diff --git a/react/features/base/react/components/native/BaseIndicator.js b/react/features/base/react/components/native/BaseIndicator.js index 897ad6795..81d8533b8 100644 --- a/react/features/base/react/components/native/BaseIndicator.js +++ b/react/features/base/react/components/native/BaseIndicator.js @@ -26,11 +26,6 @@ type Props = { */ icon: string, - /** - * Size of icon. - */ - iconSize: ?number, - /** * Additional style to be applied to the icon element. */ @@ -48,19 +43,12 @@ export default class BaseIndicator extends Component { * @inheritdoc */ render() { - const { highlight, icon, iconStyle, backgroundColor, iconSize } = this.props; - const highlightedIndicator = { ...styles.highlightedIndicator }; - - if (backgroundColor) { - highlightedIndicator.backgroundColor = backgroundColor; - } + const { icon, iconStyle } = this.props; return ( + style = { BASE_INDICATOR }> { const signalLevel = Math.floor(percent / 33.4); return ( - + + + ); } diff --git a/react/features/connection-indicator/components/native/styles.js b/react/features/connection-indicator/components/native/styles.js index c2191ea07..4f00065e5 100644 --- a/react/features/connection-indicator/components/native/styles.js +++ b/react/features/connection-indicator/components/native/styles.js @@ -7,3 +7,7 @@ export const CONNECTOR_INDICATOR_COLORS = [ ColorPalette.Y200, ColorPalette.green ]; + +export const iconStyle = { + fontSize: 14 +}; diff --git a/react/features/display-name/components/native/DisplayNameLabel.js b/react/features/display-name/components/native/DisplayNameLabel.js index eba28f712..017428402 100644 --- a/react/features/display-name/components/native/DisplayNameLabel.js +++ b/react/features/display-name/components/native/DisplayNameLabel.js @@ -4,10 +4,8 @@ import React, { Component } from 'react'; import { Text, View } from 'react-native'; import { - getLocalParticipant, getParticipantById, - getParticipantDisplayName, - shouldRenderParticipantVideo + getParticipantDisplayName } from '../../../base/participants'; import { connect } from '../../../base/redux'; @@ -25,6 +23,11 @@ type Props = { */ _render: boolean, + /** + * Whether ot not the name is in a container. + */ + contained?: boolean, + /** * The ID of the participant to render the label for. */ @@ -46,8 +49,10 @@ class DisplayNameLabel extends Component { } return ( - - + + { this.props._participantName } @@ -65,7 +70,6 @@ class DisplayNameLabel extends Component { */ function _mapStateToProps(state: Object, ownProps: Props) { const { participantId } = ownProps; - const localParticipant = getLocalParticipant(state); const participant = getParticipantById(state, participantId); const isFakeParticipant = participant && participant.isFakeParticipant; @@ -73,8 +77,6 @@ function _mapStateToProps(state: Object, ownProps: Props) { // participant and there is no video rendered for // them. const _render = Boolean(participantId) - && localParticipant?.id !== participantId - && !shouldRenderParticipantVideo(state, participantId) && !isFakeParticipant; return { diff --git a/react/features/display-name/components/native/styles.js b/react/features/display-name/components/native/styles.js index c580f9191..bb6724f30 100644 --- a/react/features/display-name/components/native/styles.js +++ b/react/features/display-name/components/native/styles.js @@ -11,8 +11,13 @@ export default { paddingVertical: 4 }, + displayNamePadding: { + padding: 2 + }, + displayNameText: { color: ColorPalette.white, - fontSize: 14 + fontSize: 14, + fontWeight: 'bold' } }; diff --git a/react/features/filmstrip/components/native/AudioMutedIndicator.js b/react/features/filmstrip/components/native/AudioMutedIndicator.js index 642f8b08b..b6a402391 100644 --- a/react/features/filmstrip/components/native/AudioMutedIndicator.js +++ b/react/features/filmstrip/components/native/AudioMutedIndicator.js @@ -16,9 +16,7 @@ export default class AudioMutedIndicator extends Component<{}> { */ render() { return ( - + ); } } diff --git a/react/features/filmstrip/components/native/DominantSpeakerIndicator.js b/react/features/filmstrip/components/native/DominantSpeakerIndicator.js deleted file mode 100644 index 6c6f4873f..000000000 --- a/react/features/filmstrip/components/native/DominantSpeakerIndicator.js +++ /dev/null @@ -1,25 +0,0 @@ -// @flow - -import React, { Component } from 'react'; - -import { IconDominantSpeaker } from '../../../base/icons'; -import { BaseIndicator } from '../../../base/react'; - -/** - * Thumbnail badge showing that the participant is the dominant speaker in - * the conference. - */ -export default class DominantSpeakerIndicator extends Component<{}> { - /** - * Implements {@code Component#render}. - * - * @inheritdoc - */ - render() { - return ( - - ); - } -} diff --git a/react/features/filmstrip/components/native/ModeratorIndicator.js b/react/features/filmstrip/components/native/ModeratorIndicator.js index 7b196e808..bd7e4308b 100644 --- a/react/features/filmstrip/components/native/ModeratorIndicator.js +++ b/react/features/filmstrip/components/native/ModeratorIndicator.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; -import { IconModerator } from '../../../base/icons'; +import { IconCrown } from '../../../base/icons'; import { BaseIndicator } from '../../../base/react'; /** @@ -16,9 +16,7 @@ export default class ModeratorIndicator extends Component<{}> { */ render() { return ( - + ); } } diff --git a/react/features/filmstrip/components/native/RaisedHandIndicator.js b/react/features/filmstrip/components/native/RaisedHandIndicator.js index e24451988..f861911f4 100644 --- a/react/features/filmstrip/components/native/RaisedHandIndicator.js +++ b/react/features/filmstrip/components/native/RaisedHandIndicator.js @@ -1,16 +1,18 @@ // @flow import React from 'react'; +import { View } from 'react-native'; import { IconRaisedHand } from '../../../base/icons'; import { BaseIndicator } from '../../../base/react'; import { connect } from '../../../base/redux'; -import BaseTheme from '../../../base/ui/components/BaseTheme.native'; import AbstractRaisedHandIndicator, { type Props, _mapStateToProps } from '../AbstractRaisedHandIndicator'; +import styles from './styles'; + /** * Thumbnail badge showing that the participant would like to speak. * @@ -24,12 +26,11 @@ class RaisedHandIndicator extends AbstractRaisedHandIndicator { */ _renderIndicator() { return ( - + + + ); } } diff --git a/react/features/filmstrip/components/native/ScreenShareIndicator.js b/react/features/filmstrip/components/native/ScreenShareIndicator.js index a56c3980c..311926371 100644 --- a/react/features/filmstrip/components/native/ScreenShareIndicator.js +++ b/react/features/filmstrip/components/native/ScreenShareIndicator.js @@ -12,8 +12,6 @@ import { BaseIndicator } from '../../../base/react'; */ export default function ScreenShareIndicator() { return ( - + ); } diff --git a/react/features/filmstrip/components/native/Thumbnail.js b/react/features/filmstrip/components/native/Thumbnail.js index eadae3390..19d0e90ec 100644 --- a/react/features/filmstrip/components/native/Thumbnail.js +++ b/react/features/filmstrip/components/native/Thumbnail.js @@ -30,11 +30,9 @@ import { toggleToolboxVisible } from '../../../toolbox/actions.native'; import { SQUARE_TILE_ASPECT_RATIO } from '../../constants'; import AudioMutedIndicator from './AudioMutedIndicator'; -import DominantSpeakerIndicator from './DominantSpeakerIndicator'; import ModeratorIndicator from './ModeratorIndicator'; import RaisedHandIndicator from './RaisedHandIndicator'; import ScreenShareIndicator from './ScreenShareIndicator'; -import VideoMutedIndicator from './VideoMutedIndicator'; import styles, { AVATAR_SIZE } from './styles'; /** @@ -105,11 +103,6 @@ type Props = { */ _styles: StyleType, - /** - * Indicates whether the participant is video muted. - */ - _videoMuted: boolean, - /** * If true, there will be no color overlay (tint) on the thumbnail * indicating the participant associated with the thumbnail is displayed on @@ -207,21 +200,12 @@ class Thumbnail extends PureComponent { _audioMuted: audioMuted, _isScreenShare: isScreenShare, _isFakeParticipant, - _renderDominantSpeakerIndicator: renderDominantSpeakerIndicator, _renderModeratorIndicator: renderModeratorIndicator, _participantId: participantId, - _videoMuted: videoMuted + renderDisplayName } = this.props; const indicators = []; - if (renderModeratorIndicator) { - indicators.push( - - ); - } - if (!_isFakeParticipant) { indicators.push( { styles.thumbnailTopIndicatorContainer, styles.thumbnailTopLeftIndicatorContainer ] }> - - { renderDominantSpeakerIndicator && } - ); - indicators.push( + + {isScreenShare && ( + + + + )} ); indicators.push( { audioMuted && } - { videoMuted && } - { isScreenShare && } + { renderModeratorIndicator && } + {renderDisplayName && } ); } @@ -266,10 +249,10 @@ class Thumbnail extends PureComponent { _participantInLargeVideo: participantInLargeVideo, _pinned, _raisedHand, + _renderDominantSpeakerIndicator, _styles, disableTint, height, - renderDisplayName, tileView } = this.props; const styleOverrides = tileView ? { @@ -289,23 +272,17 @@ class Thumbnail extends PureComponent { styles.thumbnail, _pinned && !tileView ? _styles.thumbnailPinned : null, styleOverrides, - _raisedHand ? styles.thumbnailRaisedHand : null + _raisedHand ? styles.thumbnailRaisedHand : null, + _renderDominantSpeakerIndicator ? styles.thumbnailDominantSpeaker : null ] } touchFeedback = { false }> - { - renderDisplayName - && - - - } { this._renderIndicators() } @@ -336,7 +313,6 @@ function _mapStateToProps(state, ownProps) { = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.AUDIO, id); const videoTrack = getTrackByMediaTypeAndParticipant(tracks, MEDIA_TYPE.VIDEO, id); - const videoMuted = videoTrack?.muted ?? true; const isScreenShare = videoTrack?.videoType === VIDEO_TYPE.DESKTOP; const participantCount = getParticipantCount(state); const renderDominantSpeakerIndicator = participant && participant.dominantSpeaker && participantCount > 2; @@ -357,8 +333,7 @@ function _mapStateToProps(state, ownProps) { _raisedHand: hasRaisedHand(participant), _renderDominantSpeakerIndicator: renderDominantSpeakerIndicator, _renderModeratorIndicator: renderModeratorIndicator, - _styles: ColorSchemeRegistry.get(state, 'Thumbnail'), - _videoMuted: videoMuted + _styles: ColorSchemeRegistry.get(state, 'Thumbnail') }; } diff --git a/react/features/filmstrip/components/native/VideoMutedIndicator.js b/react/features/filmstrip/components/native/VideoMutedIndicator.js deleted file mode 100644 index c3fad9e95..000000000 --- a/react/features/filmstrip/components/native/VideoMutedIndicator.js +++ /dev/null @@ -1,24 +0,0 @@ -// @flow - -import React, { Component } from 'react'; - -import { IconCameraDisabled } from '../../../base/icons'; -import { BaseIndicator } from '../../../base/react'; - -/** - * Thumbnail badge for displaying the video mute status of a participant. - */ -export default class VideoMutedIndicator extends Component<{}> { - /** - * Implements React's {@link Component#render()}. - * - * @inheritdoc - */ - render() { - return ( - - ); - } -} diff --git a/react/features/filmstrip/components/native/styles.js b/react/features/filmstrip/components/native/styles.js index 6fb4e6bda..6ed9488c5 100644 --- a/react/features/filmstrip/components/native/styles.js +++ b/react/features/filmstrip/components/native/styles.js @@ -1,7 +1,6 @@ // @flow import { ColorSchemeRegistry, schemeColor } from '../../../base/color-scheme'; -import { ColorPalette } from '../../../base/styles'; import BaseTheme from '../../../base/ui/components/BaseTheme.native'; import { SMALL_THUMBNAIL_SIZE } from '../../constants'; @@ -10,6 +9,13 @@ import { SMALL_THUMBNAIL_SIZE } from '../../constants'; */ export const AVATAR_SIZE = 50; +const indicatorContainer = { + backgroundColor: 'rgba(0, 0, 0, 0.7)', + borderRadius: 4, + margin: 2, + padding: 2 +}; + /** * The styles of the feature filmstrip. */ @@ -28,11 +34,7 @@ export default { * The display name container. */ displayNameContainer: { - alignSelf: 'center', - bottom: 0, - flex: 1, - margin: 4, - position: 'absolute' + padding: 2 }, /** @@ -96,21 +98,15 @@ export default { flexDirection: 'row' }, - moderatorIndicatorContainer: { - bottom: 4, - position: 'absolute', - right: 4 - }, - /** * The style of a participant's Thumbnail which renders either the video or * the avatar of the associated participant. */ thumbnail: { alignItems: 'stretch', - backgroundColor: ColorPalette.appBackground, + backgroundColor: BaseTheme.palette.ui02, borderColor: '#424242', - borderRadius: 3, + borderRadius: 4, borderStyle: 'solid', borderWidth: 1, flex: 1, @@ -124,35 +120,51 @@ export default { width: SMALL_THUMBNAIL_SIZE }, + indicatorContainer, + /** * The thumbnails indicator container. */ thumbnailIndicatorContainer: { - alignSelf: 'stretch', + alignSelf: 'center', bottom: 4, flex: 1, flexDirection: 'row', left: 4, - position: 'absolute' + position: 'absolute', + maxWidth: '95%', + overflow: 'hidden', + ...indicatorContainer }, thumbnailTopIndicatorContainer: { padding: 4, position: 'absolute', - top: 0 + top: 0, + flexDirection: 'row' }, thumbnailTopLeftIndicatorContainer: { left: 0 }, - thumbnailTopRightIndicatorContainer: { - right: 0 + raisedHandIndicator: { + ...indicatorContainer, + backgroundColor: BaseTheme.palette.warning02 + }, + + raisedHandIcon: { + color: BaseTheme.palette.uiBackground }, thumbnailRaisedHand: { borderWidth: 2, borderColor: BaseTheme.palette.warning02 + }, + + thumbnailDominantSpeaker: { + borderWidth: 4, + borderColor: BaseTheme.palette.action01Hover } }; @@ -168,13 +180,6 @@ ColorSchemeRegistry.register('Thumbnail', { backgroundColor: schemeColor('activeParticipantTint') }, - /** - * Coloring if the thumbnail background. - */ - participantViewStyle: { - backgroundColor: schemeColor('background') - }, - /** * Pinned video thumbnail style. */