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.

SpeakerStatsLabels.tsx 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { makeStyles } from '@material-ui/core/styles';
  2. import React from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. // @ts-ignore
  5. import { Tooltip } from '../../../base/tooltip';
  6. import { FACE_EXPRESSIONS_EMOJIS } from '../../../face-landmarks/constants';
  7. const useStyles = makeStyles((theme: any) => {
  8. return {
  9. labels: {
  10. padding: '22px 0 7px 0',
  11. height: 20
  12. },
  13. emojis: {
  14. paddingLeft: 27,
  15. ...theme.typography.bodyShortRegularLarge,
  16. lineHeight: `${theme.typography.bodyShortRegular.lineHeightLarge}px`
  17. }
  18. };
  19. });
  20. /**
  21. * The type of the React {@code Component} props of {@link SpeakerStatsLabels}.
  22. */
  23. type Props = {
  24. /**
  25. * True if the face expressions detection is not disabled.
  26. */
  27. showFaceExpressions: boolean;
  28. };
  29. const SpeakerStatsLabels = (props: Props) => {
  30. const { t } = useTranslation();
  31. const classes = useStyles();
  32. const nameTimeClass = `name-time${
  33. props.showFaceExpressions ? ' name-time_expressions-on' : ''
  34. }`;
  35. return (
  36. <div className = { `row ${classes.labels}` }>
  37. <div className = 'avatar' />
  38. <div className = { nameTimeClass }>
  39. <div>
  40. { t('speakerStats.name') }
  41. </div>
  42. <div>
  43. { t('speakerStats.speakerTime') }
  44. </div>
  45. </div>
  46. {
  47. props.showFaceExpressions
  48. && <div className = { `expressions ${classes.emojis}` }>
  49. {Object.keys(FACE_EXPRESSIONS_EMOJIS).map(
  50. expression => (
  51. <div
  52. className = 'expression'
  53. key = { expression }>
  54. <Tooltip
  55. content = { t(`speakerStats.${expression}`) }
  56. position = { 'top' } >
  57. <div>
  58. {FACE_EXPRESSIONS_EMOJIS[expression as keyof typeof FACE_EXPRESSIONS_EMOJIS]}
  59. </div>
  60. </Tooltip>
  61. </div>
  62. )
  63. )}
  64. </div>
  65. }
  66. </div>
  67. );
  68. };
  69. export default SpeakerStatsLabels;