2022-08-25 11:35:19 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2022-09-13 07:36:00 +00:00
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
2022-09-13 07:36:00 +00:00
|
|
|
import { makeStyles } from 'tss-react/mui';
|
2021-12-15 13:18:41 +00:00
|
|
|
|
2022-10-20 09:11:27 +00:00
|
|
|
import { IReduxState } from '../../../app/types';
|
2022-05-12 22:47:38 +00:00
|
|
|
import {
|
|
|
|
getMultipleVideoSupportFeatureFlag,
|
|
|
|
isDisplayNameVisible,
|
|
|
|
isNameReadOnly
|
|
|
|
} from '../../../base/config/functions.any';
|
2022-10-06 11:12:57 +00:00
|
|
|
import { isScreenShareParticipantById } from '../../../base/participants/functions';
|
2021-12-15 13:18:41 +00:00
|
|
|
import DisplayName from '../../../display-name/components/web/DisplayName';
|
2022-04-12 13:19:10 +00:00
|
|
|
import { THUMBNAIL_TYPE } from '../../constants';
|
2021-12-15 13:18:41 +00:00
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
2021-12-15 13:18:41 +00:00
|
|
|
import StatusIndicators from './StatusIndicators';
|
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
declare let interfaceConfig: any;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class name for indicators container.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
className: string;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the indicators are for the local participant.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
local: boolean;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Id of the participant for which the component is displayed.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
participantId: string;
|
2022-04-04 18:57:58 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not to show the status indicators.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
showStatusIndicators?: boolean;
|
2022-04-12 13:19:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of thumbnail.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
thumbnailType: string;
|
|
|
|
};
|
2021-12-15 13:18:41 +00:00
|
|
|
|
2022-09-13 07:36:00 +00:00
|
|
|
const useStyles = makeStyles()(() => {
|
2021-12-15 13:18:41 +00:00
|
|
|
return {
|
|
|
|
nameContainer: {
|
|
|
|
display: 'flex',
|
|
|
|
overflow: 'hidden',
|
|
|
|
padding: '2px 0',
|
|
|
|
|
|
|
|
'&>div': {
|
|
|
|
display: 'flex',
|
|
|
|
overflow: 'hidden'
|
|
|
|
},
|
|
|
|
|
|
|
|
'&:first-child': {
|
|
|
|
marginLeft: '6px'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
const ThumbnailBottomIndicators = ({
|
|
|
|
className,
|
|
|
|
local,
|
2022-04-04 18:57:58 +00:00
|
|
|
participantId,
|
2022-04-12 13:19:10 +00:00
|
|
|
showStatusIndicators = true,
|
|
|
|
thumbnailType
|
2021-12-15 13:18:41 +00:00
|
|
|
}: Props) => {
|
2022-09-13 07:36:00 +00:00
|
|
|
const { classes: styles } = useStyles();
|
2021-12-15 13:18:41 +00:00
|
|
|
const _allowEditing = !useSelector(isNameReadOnly);
|
|
|
|
const _defaultLocalDisplayName = interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME;
|
2022-05-12 22:47:38 +00:00
|
|
|
const _isMultiStreamEnabled = useSelector(getMultipleVideoSupportFeatureFlag);
|
2022-01-25 11:17:27 +00:00
|
|
|
const _showDisplayName = useSelector(isDisplayNameVisible);
|
2022-10-06 11:12:57 +00:00
|
|
|
const isVirtualScreenshareParticipant = useSelector(
|
2022-10-20 09:11:27 +00:00
|
|
|
(state: IReduxState) => isScreenShareParticipantById(state, participantId)
|
2022-10-06 11:12:57 +00:00
|
|
|
);
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
return (<div className = { className }>
|
2022-04-04 18:57:58 +00:00
|
|
|
{
|
|
|
|
showStatusIndicators && <StatusIndicators
|
2022-05-12 22:47:38 +00:00
|
|
|
audio = { !isVirtualScreenshareParticipant }
|
2022-04-04 18:57:58 +00:00
|
|
|
moderator = { true }
|
|
|
|
participantID = { participantId }
|
2022-05-12 22:47:38 +00:00
|
|
|
screenshare = { _isMultiStreamEnabled
|
|
|
|
? isVirtualScreenshareParticipant
|
|
|
|
: thumbnailType === THUMBNAIL_TYPE.TILE }
|
2022-04-12 13:19:10 +00:00
|
|
|
thumbnailType = { thumbnailType } />
|
2022-04-04 18:57:58 +00:00
|
|
|
}
|
2021-12-20 08:46:47 +00:00
|
|
|
{
|
|
|
|
_showDisplayName && (
|
|
|
|
<span className = { styles.nameContainer }>
|
|
|
|
<DisplayName
|
|
|
|
allowEditing = { local ? _allowEditing : false }
|
|
|
|
displayNameSuffix = { local ? _defaultLocalDisplayName : '' }
|
|
|
|
elementID = { local ? 'localDisplayName' : `participant_${participantId}_name` }
|
2022-04-12 13:19:10 +00:00
|
|
|
participantID = { participantId }
|
|
|
|
thumbnailType = { thumbnailType } />
|
2021-12-20 08:46:47 +00:00
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|
2021-12-15 13:18:41 +00:00
|
|
|
</div>);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ThumbnailBottomIndicators;
|