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-10-11 10:47:54 +00:00
|
|
|
import { getMultipleVideoSupportFeatureFlag } from '../../../base/config/functions.any';
|
2021-12-15 13:18:41 +00:00
|
|
|
import { isMobileBrowser } from '../../../base/environment/utils';
|
2022-10-06 11:12:57 +00:00
|
|
|
import { isScreenShareParticipantById } from '../../../base/participants/functions';
|
2021-12-15 13:18:41 +00:00
|
|
|
import ConnectionIndicator from '../../../connection-indicator/components/web/ConnectionIndicator';
|
2022-04-12 13:19:10 +00:00
|
|
|
import { STATS_POPOVER_POSITION, THUMBNAIL_TYPE } from '../../constants';
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
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';
|
2022-08-25 11:35:19 +00:00
|
|
|
// @ts-ignore
|
2021-12-15 13:18:41 +00:00
|
|
|
import StatusIndicators from './StatusIndicators';
|
|
|
|
import VideoMenuTriggerButton from './VideoMenuTriggerButton';
|
|
|
|
|
2022-08-25 11:35:19 +00:00
|
|
|
declare let interfaceConfig: any;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
2022-09-30 14:50:45 +00:00
|
|
|
/**
|
|
|
|
* Whether to hide the connection indicator.
|
|
|
|
*/
|
|
|
|
disableConnectionIndicator?: boolean;
|
|
|
|
|
2021-12-15 13:18:41 +00:00
|
|
|
/**
|
|
|
|
* Hide popover callback.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
hidePopover: Function;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Class name for the status indicators container.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
indicatorsClassName: string;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether or not the thumbnail is hovered.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
isHovered: boolean;
|
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;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Whether popover is visible or not.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
popoverVisible: boolean;
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Show popover callback.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
showPopover: Function;
|
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 {
|
|
|
|
container: {
|
|
|
|
display: 'flex',
|
|
|
|
|
|
|
|
'& > *:not(:last-child)': {
|
|
|
|
marginRight: '4px'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
const ThumbnailTopIndicators = ({
|
2022-09-30 14:50:45 +00:00
|
|
|
disableConnectionIndicator,
|
2021-12-15 13:18:41 +00:00
|
|
|
hidePopover,
|
|
|
|
indicatorsClassName,
|
|
|
|
isHovered,
|
|
|
|
local,
|
|
|
|
participantId,
|
|
|
|
popoverVisible,
|
2022-04-12 13:19:10 +00:00
|
|
|
showPopover,
|
|
|
|
thumbnailType
|
2021-12-15 13:18:41 +00:00
|
|
|
}: Props) => {
|
2022-09-13 07:36:00 +00:00
|
|
|
const { classes: styles, cx } = useStyles();
|
2021-12-15 13:18:41 +00:00
|
|
|
|
|
|
|
const _isMobile = isMobileBrowser();
|
|
|
|
const { NORMAL = 16 } = interfaceConfig.INDICATOR_FONT_SIZES || {};
|
|
|
|
const _indicatorIconSize = NORMAL;
|
|
|
|
const _connectionIndicatorAutoHideEnabled = Boolean(
|
2022-10-20 09:11:27 +00:00
|
|
|
useSelector((state: IReduxState) => state['features/base/config'].connectionIndicators?.autoHide) ?? true);
|
2022-09-30 14:50:45 +00:00
|
|
|
const _connectionIndicatorDisabled = _isMobile || disableConnectionIndicator
|
2022-10-20 09:11:27 +00:00
|
|
|
|| Boolean(useSelector((state: IReduxState) => 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-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
|
|
|
|
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);
|
|
|
|
|
2022-09-13 07:36:00 +00:00
|
|
|
return (<>
|
|
|
|
<div className = { styles.container }>
|
|
|
|
<PinnedIndicator
|
|
|
|
iconSize = { _indicatorIconSize }
|
|
|
|
participantId = { participantId }
|
|
|
|
tooltipPosition = { tooltipPosition } />
|
|
|
|
{!_connectionIndicatorDisabled
|
|
|
|
&& <ConnectionIndicator
|
|
|
|
alwaysVisible = { showConnectionIndicator }
|
|
|
|
enableStatsDisplay = { true }
|
2022-03-29 08:45:09 +00:00
|
|
|
iconSize = { _indicatorIconSize }
|
|
|
|
participantId = { participantId }
|
2022-09-13 07:36:00 +00:00
|
|
|
statsPopoverPosition = { STATS_POPOVER_POSITION[thumbnailType] } />
|
|
|
|
}
|
|
|
|
<RaisedHandIndicator
|
|
|
|
iconSize = { _indicatorIconSize }
|
|
|
|
participantId = { participantId }
|
|
|
|
tooltipPosition = { tooltipPosition } />
|
|
|
|
{thumbnailType !== THUMBNAIL_TYPE.TILE && (
|
|
|
|
<div className = { cx(indicatorsClassName, 'top-indicators') }>
|
|
|
|
<StatusIndicators
|
|
|
|
participantID = { participantId }
|
|
|
|
screenshare = { !_isMultiStreamEnabled } />
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
<div className = { styles.container }>
|
|
|
|
<VideoMenuTriggerButton
|
|
|
|
hidePopover = { hidePopover }
|
|
|
|
local = { local }
|
|
|
|
participantId = { participantId }
|
|
|
|
popoverVisible = { popoverVisible }
|
|
|
|
showPopover = { showPopover }
|
|
|
|
thumbnailType = { thumbnailType }
|
|
|
|
visible = { isHovered } />
|
|
|
|
</div>
|
|
|
|
</>);
|
2021-12-15 13:18:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
export default ThumbnailTopIndicators;
|