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 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // @flow
  2. import React from 'react';
  3. import { View, Text } from 'react-native';
  4. import { Avatar, StatelessAvatar } from '../../../base/avatar';
  5. import { getInitials } from '../../../base/avatar/functions';
  6. import BaseTheme from '../../../base/ui/components/BaseTheme.native';
  7. import TimeElapsed from './TimeElapsed';
  8. import style from './styles';
  9. type Props = {
  10. /**
  11. * The name of the participant.
  12. */
  13. displayName: string,
  14. /**
  15. * The total milliseconds the participant has been dominant speaker.
  16. */
  17. dominantSpeakerTime: number,
  18. /**
  19. * The id of the user.
  20. */
  21. participantId: string,
  22. /**
  23. * True if the participant is no longer in the meeting.
  24. */
  25. hasLeft: boolean,
  26. /**
  27. * True if the participant is currently the dominant speaker.
  28. */
  29. isDominantSpeaker: boolean
  30. };
  31. const SpeakerStatsItem = (props: Props) =>
  32. (
  33. <View
  34. key = { props.participantId }
  35. style = { style.speakerStatsItemContainer }>
  36. <View style = { style.speakerStatsAvatar }>
  37. {
  38. props.hasLeft ? (
  39. <StatelessAvatar
  40. className = 'userAvatar'
  41. color = { BaseTheme.palette.ui05 }
  42. id = 'avatar'
  43. initials = { getInitials(props.displayName) }
  44. size = { BaseTheme.spacing[5] } />
  45. ) : (
  46. <Avatar
  47. className = 'userAvatar'
  48. participantId = { props.participantId }
  49. size = { BaseTheme.spacing[5] } />
  50. )
  51. }
  52. </View>
  53. <View style = { style.speakerStatsNameTime } >
  54. <Text style = { [ style.speakerStatsText, props.hasLeft && style.speakerStatsLeft ] }>
  55. {props.displayName}
  56. </Text>
  57. <TimeElapsed
  58. style = { [
  59. style.speakerStatsText,
  60. style.speakerStatsTime,
  61. props.isDominantSpeaker && style.speakerStatsDominant,
  62. props.hasLeft && style.speakerStatsLeft
  63. ] }
  64. time = { props.dominantSpeakerTime } />
  65. </View>
  66. </View>
  67. );
  68. export default SpeakerStatsItem;