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

SpeakerStatsItem.tsx 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // eslint-disable-next-line lines-around-comment
  2. import React from 'react';
  3. // @ts-ignore
  4. import Avatar from '../../../base/avatar/components/Avatar';
  5. import StatelessAvatar from '../../../base/avatar/components/web/StatelessAvatar';
  6. import { getInitials } from '../../../base/avatar/functions';
  7. import BaseTheme from '../../../base/ui/components/BaseTheme.web';
  8. import { FaceLandmarks } from '../../../face-landmarks/types';
  9. import TimeElapsed from './TimeElapsed';
  10. import Timeline from './Timeline';
  11. /**
  12. * The type of the React {@code Component} props of {@link SpeakerStatsItem}.
  13. */
  14. type Props = {
  15. /**
  16. * The name of the participant.
  17. */
  18. displayName: string;
  19. /**
  20. * The total milliseconds the participant has been dominant speaker.
  21. */
  22. dominantSpeakerTime: number;
  23. /**
  24. * The object that has as keys the face expressions of the
  25. * participant and as values a number that represents the count .
  26. */
  27. faceLandmarks?: FaceLandmarks[];
  28. /**
  29. * True if the participant is no longer in the meeting.
  30. */
  31. hasLeft: boolean;
  32. /**
  33. * True if the participant is not shown in speaker stats.
  34. */
  35. hidden: boolean;
  36. /**
  37. * True if the participant is currently the dominant speaker.
  38. */
  39. isDominantSpeaker: boolean;
  40. /**
  41. * The id of the user.
  42. */
  43. participantId: string;
  44. /**
  45. * True if the face expressions detection is not disabled.
  46. */
  47. showFaceExpressions: boolean;
  48. /**
  49. * Invoked to obtain translated strings.
  50. */
  51. t: Function;
  52. };
  53. const SpeakerStatsItem = (props: Props) => {
  54. const rowDisplayClass = `row item ${props.hasLeft ? 'has-left' : ''}`;
  55. const nameTimeClass = `name-time${
  56. props.showFaceExpressions ? ' expressions-on' : ''
  57. }`;
  58. const timeClass = `time ${props.isDominantSpeaker ? 'dominant' : ''}`;
  59. return (
  60. <div key = { props.participantId }>
  61. <div className = { rowDisplayClass } >
  62. <div className = 'avatar' >
  63. {
  64. props.hasLeft ? (
  65. <StatelessAvatar
  66. className = 'userAvatar'
  67. color = { BaseTheme.palette.ui04 }
  68. initials = { getInitials(props.displayName) } />
  69. ) : (
  70. <Avatar
  71. // @ts-ignore
  72. className = 'userAvatar'
  73. participantId = { props.participantId } />
  74. )
  75. }
  76. </div>
  77. <div className = { nameTimeClass }>
  78. <div
  79. aria-label = { props.t('speakerStats.speakerStats') }
  80. className = 'display-name'>
  81. { props.displayName }
  82. </div>
  83. <div
  84. aria-label = { props.t('speakerStats.speakerTime') }
  85. className = { timeClass }>
  86. <TimeElapsed
  87. time = { props.dominantSpeakerTime } />
  88. </div>
  89. </div>
  90. { props.showFaceExpressions
  91. && <Timeline faceLandmarks = { props.faceLandmarks } />
  92. }
  93. </div>
  94. <div className = 'separator' />
  95. </div>
  96. );
  97. };
  98. export default SpeakerStatsItem;