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

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