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.js 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* @flow */
  2. import { makeStyles } from '@material-ui/core/styles';
  3. import React from 'react';
  4. import { useTranslation } from 'react-i18next';
  5. import { Tooltip } from '../../../base/tooltip';
  6. import { FACE_EXPRESSIONS_EMOJIS } from '../../../face-landmarks/constants';
  7. const useStyles = makeStyles(theme => {
  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 FaceExpressionsLabels = () => Object.keys(FACE_EXPRESSIONS_EMOJIS).map(
  33. expression => (
  34. <div
  35. className = 'expression'
  36. key = { expression }>
  37. <Tooltip
  38. content = { t(`speakerStats.${expression}`) }
  39. position = { 'top' } >
  40. <div>
  41. { FACE_EXPRESSIONS_EMOJIS[expression] }
  42. </div>
  43. </Tooltip>
  44. </div>
  45. )
  46. );
  47. const nameTimeClass = `name-time${
  48. props.showFaceExpressions ? ' name-time_expressions-on' : ''
  49. }`;
  50. return (
  51. <div className = { `row ${classes.labels}` }>
  52. <div className = 'avatar' />
  53. <div className = { nameTimeClass }>
  54. <div>
  55. { t('speakerStats.name') }
  56. </div>
  57. <div>
  58. { t('speakerStats.speakerTime') }
  59. </div>
  60. </div>
  61. {
  62. props.showFaceExpressions
  63. && <div className = { `expressions ${classes.emojis}` }>
  64. <FaceExpressionsLabels />
  65. </div>
  66. }
  67. </div>
  68. );
  69. };
  70. export default SpeakerStatsLabels;