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
45 lines
1.5 KiB
TypeScript
45 lines
1.5 KiB
TypeScript
import React, { useCallback } from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
import { makeStyles } from 'tss-react/mui';
|
|
|
|
import { IReduxState } from '../../../app/types';
|
|
import { IconRaiseHand } from '../../../base/icons/svg';
|
|
import Label from '../../../base/label/components/web/Label';
|
|
import Tooltip from '../../../base/tooltip/components/Tooltip';
|
|
import { open as openParticipantsPane } from '../../../participants-pane/actions.web';
|
|
|
|
const useStyles = makeStyles()(theme => {
|
|
return {
|
|
label: {
|
|
backgroundColor: theme.palette.warning02,
|
|
color: theme.palette.uiBackground
|
|
}
|
|
};
|
|
});
|
|
|
|
const RaisedHandsCountLabel = () => {
|
|
const { classes: styles, theme } = useStyles();
|
|
const dispatch = useDispatch();
|
|
const raisedHandsCount = useSelector((state: IReduxState) =>
|
|
(state['features/base/participants'].raisedHandsQueue || []).length);
|
|
const { t } = useTranslation();
|
|
const onClick = useCallback(() => {
|
|
dispatch(openParticipantsPane());
|
|
}, []);
|
|
|
|
return raisedHandsCount > 0 && (<Tooltip
|
|
content = { t('raisedHandsLabel') }
|
|
position = { 'bottom' }>
|
|
<Label
|
|
className = { styles.label }
|
|
icon = { IconRaiseHand }
|
|
iconColor = { theme.palette.icon04 }
|
|
id = 'raisedHandsCountLabel'
|
|
onClick = { onClick }
|
|
text = { `${raisedHandsCount}` } />
|
|
</Tooltip>);
|
|
};
|
|
|
|
export default RaisedHandsCountLabel;
|