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.9KB

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