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

SpeakerStatsItem.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. * True if the participant is no longer in the meeting.
  19. */
  20. hasLeft: boolean,
  21. /**
  22. * True if the participant is currently the dominant speaker.
  23. */
  24. isDominantSpeaker: boolean,
  25. /**
  26. * Invoked to obtain translated strings.
  27. */
  28. t: Function
  29. };
  30. /**
  31. * React component for display an individual user's speaker stats.
  32. *
  33. * @extends Component
  34. */
  35. class SpeakerStatsItem extends Component<Props> {
  36. /**
  37. * Implements React's {@link Component#render()}.
  38. *
  39. * @inheritdoc
  40. * @returns {ReactElement}
  41. */
  42. render() {
  43. const hasLeftClass = this.props.hasLeft ? 'status-user-left' : '';
  44. const rowDisplayClass = `speaker-stats-item ${hasLeftClass}`;
  45. const dotClass = this.props.isDominantSpeaker
  46. ? 'status-active' : 'status-inactive';
  47. const speakerStatusClass = `speaker-stats-item__status-dot ${dotClass}`;
  48. return (
  49. <div className = { rowDisplayClass }>
  50. <div className = 'speaker-stats-item__status'>
  51. <span className = { speakerStatusClass } />
  52. </div>
  53. <div
  54. aria-label = { this.props.t('speakerStats.speakerStats') }
  55. className = 'speaker-stats-item__name'>
  56. { this.props.displayName }
  57. </div>
  58. <div
  59. aria-label = { this.props.t('speakerStats.speakerTime') }
  60. className = 'speaker-stats-item__time'>
  61. <TimeElapsed
  62. time = { this.props.dominantSpeakerTime } />
  63. </div>
  64. </div>
  65. );
  66. }
  67. }
  68. export default translate(SpeakerStatsItem);