您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

SpeakerStatsLabels.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { translate } from '../../base/i18n';
  4. import { Tooltip } from '../../base/tooltip';
  5. import { FACIAL_EXPRESSION_EMOJIS } from '../../facial-recognition/constants.js';
  6. /**
  7. * The type of the React {@code Component} props of {@link SpeakerStatsLabels}.
  8. */
  9. type Props = {
  10. /**
  11. * True if the client width is les than 750.
  12. */
  13. reduceExpressions: boolean,
  14. /**
  15. * True if the facial recognition is not disabled.
  16. */
  17. showFacialExpressions: boolean,
  18. /**
  19. * The function to translate human-readable text.
  20. */
  21. t: Function,
  22. };
  23. /**
  24. * React component for labeling speaker stats column items.
  25. *
  26. * @augments Component
  27. */
  28. class SpeakerStatsLabels extends Component<Props> {
  29. /**
  30. * Implements React's {@link Component#render()}.
  31. *
  32. * @inheritdoc
  33. * @returns {ReactElement}
  34. */
  35. render() {
  36. const { t } = this.props;
  37. return (
  38. <div className = 'speaker-stats-item__labels'>
  39. <div className = 'speaker-stats-item__status' />
  40. <div
  41. className = { `speaker-stats-item__name${
  42. this.props.showFacialExpressions ? '_expressions_on' : ''
  43. }` }>
  44. { t('speakerStats.name') }
  45. </div>
  46. <div
  47. className = { `speaker-stats-item__time${
  48. this.props.showFacialExpressions ? '_expressions_on' : ''
  49. }` }>
  50. { t('speakerStats.speakerTime') }
  51. </div>
  52. {this.props.showFacialExpressions
  53. && (this.props.reduceExpressions
  54. ? Object.keys(FACIAL_EXPRESSION_EMOJIS)
  55. .filter(expression => ![ 'angry', 'fearful', 'disgusted' ].includes(expression))
  56. : Object.keys(FACIAL_EXPRESSION_EMOJIS)
  57. ).map(
  58. expression => (
  59. <div
  60. className = 'speaker-stats-item__expression'
  61. key = { expression }>
  62. <Tooltip
  63. content = { t(`speakerStats.${expression}`) }
  64. position = { 'top' } >
  65. <div
  66. // eslint-disable-next-line react-native/no-inline-styles
  67. style = {{ fontSize: 17 }}>
  68. { FACIAL_EXPRESSION_EMOJIS[expression] }
  69. </div>
  70. </Tooltip>
  71. </div>
  72. ))
  73. }
  74. </div>
  75. );
  76. }
  77. }
  78. export default translate(SpeakerStatsLabels);