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.

SpeakerStatsItem.js 5.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import { translate } from '../../base/i18n';
  4. import TimeElapsed from './TimeElapsed';
  5. /**
  6. * The type of the React {@code Component} props of {@link SpeakerStatsItem}.
  7. */
  8. type Props = {
  9. /**
  10. * The name of the participant.
  11. */
  12. displayName: string,
  13. /**
  14. * The total milliseconds the participant has been dominant speaker.
  15. */
  16. dominantSpeakerTime: number,
  17. /**
  18. * The object that has as keys the facial expressions of the
  19. * participant and as values a number that represents the count .
  20. */
  21. facialExpressions: Object,
  22. /**
  23. * True if the participant is no longer in the meeting.
  24. */
  25. hasLeft: boolean,
  26. /**
  27. * True if the participant is currently the dominant speaker.
  28. */
  29. isDominantSpeaker: boolean,
  30. /**
  31. * True if the client width is les than 750.
  32. */
  33. reduceExpressions: boolean,
  34. /**
  35. * True if the facial recognition is not disabled.
  36. */
  37. showFacialExpressions: boolean,
  38. /**
  39. * Invoked to obtain translated strings.
  40. */
  41. t: Function
  42. };
  43. /**
  44. * React component for display an individual user's speaker stats.
  45. *
  46. * @augments Component
  47. */
  48. class SpeakerStatsItem extends Component<Props> {
  49. /**
  50. * Implements React's {@link Component#render()}.
  51. *
  52. * @inheritdoc
  53. * @returns {ReactElement}
  54. */
  55. render() {
  56. const hasLeftClass = this.props.hasLeft ? 'status-user-left' : '';
  57. const rowDisplayClass = `speaker-stats-item ${hasLeftClass}`;
  58. const dotClass = this.props.isDominantSpeaker
  59. ? 'status-active' : 'status-inactive';
  60. const speakerStatusClass = `speaker-stats-item__status-dot ${dotClass}`;
  61. return (
  62. <div className = { rowDisplayClass }>
  63. <div className = 'speaker-stats-item__status'>
  64. <span className = { speakerStatusClass } />
  65. </div>
  66. <div
  67. aria-label = { this.props.t('speakerStats.speakerStats') }
  68. className = { `speaker-stats-item__name${
  69. this.props.showFacialExpressions ? '_expressions_on' : ''
  70. }` }>
  71. { this.props.displayName }
  72. </div>
  73. <div
  74. aria-label = { this.props.t('speakerStats.speakerTime') }
  75. className = { `speaker-stats-item__time${
  76. this.props.showFacialExpressions ? '_expressions_on' : ''
  77. }` }>
  78. <TimeElapsed
  79. time = { this.props.dominantSpeakerTime } />
  80. </div>
  81. { this.props.showFacialExpressions
  82. && (
  83. <>
  84. <div
  85. aria-label = { 'Happy' }
  86. className = 'speaker-stats-item__expression'>
  87. { this.props.facialExpressions.happy }
  88. </div>
  89. <div
  90. aria-label = { 'Neutral' }
  91. className = 'speaker-stats-item__expression'>
  92. { this.props.facialExpressions.neutral }
  93. </div>
  94. <div
  95. aria-label = { 'Sad' }
  96. className = 'speaker-stats-item__expression'>
  97. { this.props.facialExpressions.sad }
  98. </div>
  99. <div
  100. aria-label = { 'Surprised' }
  101. className = 'speaker-stats-item__expression'>
  102. { this.props.facialExpressions.surprised }
  103. </div>
  104. {!this.props.reduceExpressions && (
  105. <>
  106. <div
  107. aria-label = { 'Angry' }
  108. className = 'speaker-stats-item__expression'>
  109. { this.props.facialExpressions.angry }
  110. </div>
  111. <div
  112. aria-label = { 'Fearful' }
  113. className = 'speaker-stats-item__expression'>
  114. { this.props.facialExpressions.fearful }
  115. </div>
  116. <div
  117. aria-label = { 'Disgusted' }
  118. className = 'speaker-stats-item__expression'>
  119. { this.props.facialExpressions.disgusted }
  120. </div>
  121. </>
  122. )}
  123. </>
  124. )
  125. }
  126. </div>
  127. );
  128. }
  129. }
  130. export default translate(SpeakerStatsItem);