2021-12-15 13:18:41 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { makeStyles } from '@material-ui/styles';
|
|
|
|
import clsx from 'clsx';
|
|
|
|
import React from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
|
|
|
|
2022-05-12 22:47:38 +00:00
|
|
|
import { getMultipleVideoSupportFeatureFlag } from '../../../base/config';
|
2021-12-15 13:18:41 +00:00
|
|
|
import { isMobileBrowser } from '../../../base/environment/utils';
|
|
|
|
import ConnectionIndicator from '../../../connection-indicator/components/web/ConnectionIndicator';
|
2022-04-12 13:19:10 +00:00
|
|
|
import { STATS_POPOVER_POSITION, THUMBNAIL_TYPE } from '../../constants';
|
2021-12-15 13:18:41 +00:00
|
|
|
import { getIndicatorsTooltipPosition } from '../../functions.web';
|
|
|
|
|
2022-03-29 08:45:09 +00:00
|
|
|
import PinnedIndicator from './PinnedIndicator';
|
2021-12-15 13:18:41 +00:00
|
|
|
import RaisedHandIndicator from './RaisedHandIndicator';
|
|
|
|
import StatusIndicators from './StatusIndicators';
|
|
|
|
import VideoMenuTriggerButton from './VideoMenuTriggerButton';
|
|
|
|
|
|
|
|
declare var interfaceConfig: Object;
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hide popover callback.
|
|
|
|
*/
|
|
|
|
hidePopover: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class name for the status indicators container.
|
|
|
|
*/
|
|
|
|
indicatorsClassName: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the thumbnail is hovered.
|
|
|
|
*/
|
|
|
|
isHovered: boolean,
|
|
|
|
|
2022-04-04 18:57:58 +00:00
|
|
|
/**
|
2022-04-29 14:32:16 +00:00
|
|
|
* Whether or not the thumbnail is a virtual screen share participant.
|
2022-04-04 18:57:58 +00:00
|
|
|
*/
|
2022-04-29 14:32:16 +00:00
|
|
|
isVirtualScreenshareParticipant: boolean,
|
2022-04-04 18:57:58 +00:00
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
/**
|
|
|
|
* Whether or not the indicators are for the local participant.
|
|
|
|
*/
|
|
|
|
local: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Id of the participant for which the component is displayed.
|
|
|
|
*/
|
|
|
|
participantId: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether popover is visible or not.
|
|
|
|
*/
|
|
|
|
popoverVisible: boolean,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Show popover callback.
|
|
|
|
*/
|
2022-04-12 13:19:10 +00:00
|
|
|
showPopover: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of thumbnail.
|
|
|
|
*/
|
|
|
|
thumbnailType: string
|
2021-12-15 13:18:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const useStyles = makeStyles(() => {
|
|
|
|
return {
|
|
|
|
container: {
|
|
|
|
display: 'flex',
|
|
|
|
|
|
|
|
'& > *:not(:last-child)': {
|
|
|
|
marginRight: '4px'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
const ThumbnailTopIndicators = ({
|
|
|
|
hidePopover,
|
|
|
|
indicatorsClassName,
|
2022-04-29 14:32:16 +00:00
|
|
|
isVirtualScreenshareParticipant,
|
2021-12-15 13:18:41 +00:00
|
|
|
isHovered,
|
|
|
|
local,
|
|
|
|
participantId,
|
|
|
|
popoverVisible,
|
2022-04-12 13:19:10 +00:00
|
|
|
showPopover,
|
|
|
|
thumbnailType
|
2021-12-15 13:18:41 +00:00
|
|
|
}: Props) => {
|
|
|
|
const styles = useStyles();
|
|
|
|
|
|
|
|
const _isMobile = isMobileBrowser();
|
|
|
|
const { NORMAL = 16 } = interfaceConfig.INDICATOR_FONT_SIZES || {};
|
|
|
|
const _indicatorIconSize = NORMAL;
|
|
|
|
const _connectionIndicatorAutoHideEnabled = Boolean(
|
|
|
|
useSelector(state => state['features/base/config'].connectionIndicators?.autoHide) ?? true);
|
|
|
|
const _connectionIndicatorDisabled = _isMobile
|
|
|
|
|| Boolean(useSelector(state => state['features/base/config'].connectionIndicators?.disabled));
|
2022-05-12 22:47:38 +00:00
|
|
|
const _isMultiStreamEnabled = useSelector(getMultipleVideoSupportFeatureFlag);
|
2021-12-15 13:18:41 +00:00
|
|
|
const showConnectionIndicator = isHovered || !_connectionIndicatorAutoHideEnabled;
|
|
|
|
|
2022-05-12 22:47:38 +00:00
|
|
|
if (_isMultiStreamEnabled && isVirtualScreenshareParticipant) {
|
2022-04-04 18:57:58 +00:00
|
|
|
return (
|
|
|
|
<div className = { styles.container }>
|
|
|
|
{!_connectionIndicatorDisabled
|
|
|
|
&& <ConnectionIndicator
|
|
|
|
alwaysVisible = { showConnectionIndicator }
|
|
|
|
enableStatsDisplay = { true }
|
|
|
|
iconSize = { _indicatorIconSize }
|
|
|
|
participantId = { participantId }
|
2022-04-12 13:19:10 +00:00
|
|
|
statsPopoverPosition = { STATS_POPOVER_POSITION[thumbnailType] } />
|
2022-04-04 18:57:58 +00:00
|
|
|
}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-04-12 13:19:10 +00:00
|
|
|
const tooltipPosition = getIndicatorsTooltipPosition(thumbnailType);
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<div className = { styles.container }>
|
2022-03-29 08:45:09 +00:00
|
|
|
<PinnedIndicator
|
|
|
|
iconSize = { _indicatorIconSize }
|
|
|
|
participantId = { participantId }
|
2022-04-12 13:19:10 +00:00
|
|
|
tooltipPosition = { tooltipPosition } />
|
2021-12-15 13:18:41 +00:00
|
|
|
{!_connectionIndicatorDisabled
|
|
|
|
&& <ConnectionIndicator
|
|
|
|
alwaysVisible = { showConnectionIndicator }
|
|
|
|
enableStatsDisplay = { true }
|
|
|
|
iconSize = { _indicatorIconSize }
|
|
|
|
participantId = { participantId }
|
2022-04-12 13:19:10 +00:00
|
|
|
statsPopoverPosition = { STATS_POPOVER_POSITION[thumbnailType] } />
|
2021-12-15 13:18:41 +00:00
|
|
|
}
|
|
|
|
<RaisedHandIndicator
|
|
|
|
iconSize = { _indicatorIconSize }
|
|
|
|
participantId = { participantId }
|
2022-04-12 13:19:10 +00:00
|
|
|
tooltipPosition = { tooltipPosition } />
|
|
|
|
{thumbnailType !== THUMBNAIL_TYPE.TILE && (
|
2021-12-15 13:18:41 +00:00
|
|
|
<div className = { clsx(indicatorsClassName, 'top-indicators') }>
|
|
|
|
<StatusIndicators
|
|
|
|
participantID = { participantId }
|
2022-05-12 22:47:38 +00:00
|
|
|
screenshare = { !_isMultiStreamEnabled } />
|
2021-12-15 13:18:41 +00:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
<div className = { styles.container }>
|
|
|
|
<VideoMenuTriggerButton
|
|
|
|
hidePopover = { hidePopover }
|
|
|
|
local = { local }
|
|
|
|
participantId = { participantId }
|
|
|
|
popoverVisible = { popoverVisible }
|
|
|
|
showPopover = { showPopover }
|
2022-04-12 13:19:10 +00:00
|
|
|
thumbnailType = { thumbnailType }
|
2021-12-15 13:18:41 +00:00
|
|
|
visible = { isHovered } />
|
|
|
|
</div>
|
|
|
|
</>);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ThumbnailTopIndicators;
|