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 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* @flow */
  2. import React, { Component } from 'react';
  3. import TimeElapsed from './TimeElapsed';
  4. /**
  5. * The type of the React {@code Component} props of {@link SpeakerStatsItem}.
  6. */
  7. type Props = {
  8. /**
  9. * The name of the participant.
  10. */
  11. displayName: string,
  12. /**
  13. * The total milliseconds the participant has been dominant speaker.
  14. */
  15. dominantSpeakerTime: number,
  16. /**
  17. * True if the participant is no longer in the meeting.
  18. */
  19. hasLeft: boolean,
  20. /**
  21. * True if the participant is currently the dominant speaker.
  22. */
  23. isDominantSpeaker: boolean
  24. };
  25. /**
  26. * React component for display an individual user's speaker stats.
  27. *
  28. * @extends Component
  29. */
  30. class SpeakerStatsItem extends Component<Props> {
  31. /**
  32. * Implements React's {@link Component#render()}.
  33. *
  34. * @inheritdoc
  35. * @returns {ReactElement}
  36. */
  37. render() {
  38. const hasLeftClass = this.props.hasLeft ? 'status-user-left' : '';
  39. const rowDisplayClass = `speaker-stats-item ${hasLeftClass}`;
  40. const dotClass = this.props.isDominantSpeaker
  41. ? 'status-active' : 'status-inactive';
  42. const speakerStatusClass = `speaker-stats-item__status-dot ${dotClass}`;
  43. return (
  44. <div className = { rowDisplayClass }>
  45. <div className = 'speaker-stats-item__status'>
  46. <span className = { speakerStatusClass } />
  47. </div>
  48. <div className = 'speaker-stats-item__name'>
  49. { this.props.displayName }
  50. </div>
  51. <div className = 'speaker-stats-item__time'>
  52. <TimeElapsed
  53. time = { this.props.dominantSpeakerTime } />
  54. </div>
  55. </div>
  56. );
  57. }
  58. }
  59. export default SpeakerStatsItem;