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.

ParticipantItem.js 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // @flow
  2. import React from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { View } from 'react-native';
  5. import { Text } from 'react-native-paper';
  6. import { useSelector } from 'react-redux';
  7. import { Avatar } from '../../../base/avatar';
  8. import { getParticipantDisplayNameWithId } from '../../../base/participants';
  9. import { ActionTrigger, MediaState } from '../../constants';
  10. // import { AudioStateIcons, VideoStateIcons } from '../web/ParticipantItem';
  11. import { RaisedHandIndicator } from './RaisedHandIndicator';
  12. import styles from './styles';
  13. type Props = {
  14. /**
  15. * Type of trigger for the participant actions
  16. */
  17. actionsTrigger: ActionTrigger,
  18. /**
  19. * Media state for audio
  20. */
  21. audioMuteState: MediaState,
  22. /**
  23. * Callback for when the mouse leaves this component
  24. */
  25. onLeave?: Function,
  26. /**
  27. * Participant reference
  28. */
  29. participant: Object,
  30. /**
  31. * Media state for video
  32. */
  33. videoMuteState: MediaState
  34. }
  35. /**
  36. * Participant item.
  37. *
  38. * @returns {React$Element<any>}
  39. */
  40. function ParticipantItem({
  41. audioMuteState = MediaState.None,
  42. videoMuteState = MediaState.None,
  43. participant: p
  44. }: Props) {
  45. const { t } = useTranslation();
  46. const name = useSelector(getParticipantDisplayNameWithId(p.id));
  47. return (
  48. <View style = { styles.participantContainer } >
  49. <Avatar
  50. className = 'participant-avatar'
  51. participant = { p.id }
  52. size = { 32 } />
  53. <View style = { styles.participantContent }>
  54. <View style = { styles.participantNameContainer }>
  55. <Text style = { styles.participantName }>
  56. { name }
  57. </Text>
  58. { p.local ? <Text>({t('chat.you')})</Text> : null }
  59. </View>
  60. <View style = { styles.participantStates } >
  61. {p.raisedHand && <RaisedHandIndicator />}
  62. {VideoStateIcons[videoMuteState]}
  63. {AudioStateIcons[audioMuteState]}
  64. </View>
  65. </View>
  66. </View>
  67. );
  68. }
  69. export default ParticipantItem;