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.tsx 3.5KB

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