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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 { IconUser } from '../../../base/icons/svg';
  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. interface IProps {
  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: IProps) => {
  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. iconUser = { IconUser }
  69. initials = { getInitials(props.displayName) }
  70. size = { 32 } />
  71. ) : (
  72. <Avatar
  73. className = 'userAvatar'
  74. participantId = { props.participantId }
  75. size = { 32 } />
  76. )
  77. }
  78. </div>
  79. <div className = { nameTimeClass }>
  80. <div
  81. aria-label = { props.t('speakerStats.speakerStats') }
  82. className = 'display-name'>
  83. { props.displayName }
  84. </div>
  85. <div
  86. aria-label = { props.t('speakerStats.speakerTime') }
  87. className = { timeClass }>
  88. <TimeElapsed
  89. time = { props.dominantSpeakerTime } />
  90. </div>
  91. </div>
  92. { props.showFaceExpressions
  93. && <Timeline faceLandmarks = { props.faceLandmarks } />
  94. }
  95. </div>
  96. <div className = 'separator' />
  97. </div>
  98. );
  99. };
  100. export default SpeakerStatsItem;