mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
Create Tooltip component Fix Popover positioning calculations Add margins to popover Remove @atlaskit/tooltip Update all components to use the new Tooltip component Added tooltip actions and reducers for the following functionality: when a user hovers over an element is sees the tooltip for that element and then hovers another element that has a tooltip, instead of using the delay and animations we just unmount the current tooltip and mount the next one immediately
78 lines
2.1 KiB
TypeScript
78 lines
2.1 KiB
TypeScript
import React from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
import { makeStyles } from 'tss-react/mui';
|
|
|
|
import { IReduxState } from '../../../app/types';
|
|
import { IconRaiseHand } from '../../../base/icons/svg';
|
|
import { getParticipantById, hasRaisedHand } from '../../../base/participants/functions';
|
|
import { IParticipant } from '../../../base/participants/types';
|
|
import BaseIndicator from '../../../base/react/components/web/BaseIndicator';
|
|
|
|
/**
|
|
* The type of the React {@code Component} props of {@link RaisedHandIndicator}.
|
|
*/
|
|
interface IProps {
|
|
|
|
/**
|
|
* The font-size for the icon.
|
|
*/
|
|
iconSize: number;
|
|
|
|
/**
|
|
* The participant id who we want to render the raised hand indicator
|
|
* for.
|
|
*/
|
|
participantId: string;
|
|
|
|
/**
|
|
* From which side of the indicator the tooltip should appear from.
|
|
*/
|
|
tooltipPosition: 'top' | 'bottom' | 'left' | 'right';
|
|
}
|
|
|
|
const useStyles = makeStyles()(theme => {
|
|
return {
|
|
raisedHandIndicator: {
|
|
backgroundColor: theme.palette.warning02,
|
|
padding: '4px',
|
|
zIndex: 3,
|
|
display: 'inline-block',
|
|
borderRadius: '4px',
|
|
boxSizing: 'border-box'
|
|
}
|
|
};
|
|
});
|
|
|
|
/**
|
|
* Thumbnail badge showing that the participant would like to speak.
|
|
*
|
|
* @returns {ReactElement}
|
|
*/
|
|
const RaisedHandIndicator = ({
|
|
iconSize,
|
|
participantId,
|
|
tooltipPosition
|
|
}: IProps) => {
|
|
const participant: IParticipant | undefined = useSelector((state: IReduxState) =>
|
|
getParticipantById(state, participantId));
|
|
const _raisedHand = hasRaisedHand(participant);
|
|
const { classes: styles, theme } = useStyles();
|
|
|
|
if (!_raisedHand) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<div className = { styles.raisedHandIndicator }>
|
|
<BaseIndicator
|
|
icon = { IconRaiseHand }
|
|
iconColor = { theme.palette.uiBackground }
|
|
iconSize = { `${iconSize}px` }
|
|
tooltipKey = 'raisedHand'
|
|
tooltipPosition = { tooltipPosition } />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default RaisedHandIndicator;
|