You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RaisedHandIndicator.tsx 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import React from 'react';
  2. import { useSelector } from 'react-redux';
  3. import { makeStyles } from 'tss-react/mui';
  4. import { IReduxState } from '../../../app/types';
  5. import { IconRaiseHand } from '../../../base/icons/svg';
  6. import { getParticipantById, hasRaisedHand } from '../../../base/participants/functions';
  7. import { IParticipant } from '../../../base/participants/types';
  8. import BaseIndicator from '../../../base/react/components/web/BaseIndicator';
  9. import { TOOLTIP_POSITION } from '../../../base/ui/constants.any';
  10. /**
  11. * The type of the React {@code Component} props of {@link RaisedHandIndicator}.
  12. */
  13. interface IProps {
  14. /**
  15. * The font-size for the icon.
  16. */
  17. iconSize: number;
  18. /**
  19. * The participant id who we want to render the raised hand indicator
  20. * for.
  21. */
  22. participantId: string;
  23. /**
  24. * From which side of the indicator the tooltip should appear from.
  25. */
  26. tooltipPosition: TOOLTIP_POSITION;
  27. }
  28. const useStyles = makeStyles()(theme => {
  29. return {
  30. raisedHandIndicator: {
  31. backgroundColor: theme.palette.warning02,
  32. padding: '4px',
  33. zIndex: 3,
  34. display: 'inline-block',
  35. borderRadius: '4px',
  36. boxSizing: 'border-box'
  37. }
  38. };
  39. });
  40. /**
  41. * Thumbnail badge showing that the participant would like to speak.
  42. *
  43. * @returns {ReactElement}
  44. */
  45. const RaisedHandIndicator = ({
  46. iconSize,
  47. participantId,
  48. tooltipPosition
  49. }: IProps) => {
  50. const participant: IParticipant | undefined = useSelector((state: IReduxState) =>
  51. getParticipantById(state, participantId));
  52. const _raisedHand = hasRaisedHand(participant);
  53. const { classes: styles, theme } = useStyles();
  54. if (!_raisedHand) {
  55. return null;
  56. }
  57. return (
  58. <div className = { styles.raisedHandIndicator }>
  59. <BaseIndicator
  60. icon = { IconRaiseHand }
  61. iconColor = { theme.palette.uiBackground }
  62. iconSize = { `${iconSize}px` }
  63. tooltipKey = 'raisedHand'
  64. tooltipPosition = { tooltipPosition } />
  65. </div>
  66. );
  67. };
  68. export default RaisedHandIndicator;