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.

LobbyParticipantItem.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { Button } from 'react-native-paper';
  5. import { useDispatch } from 'react-redux';
  6. import { setKnockingParticipantApproval } from '../../../lobby/actions.native';
  7. import { showContextMenuReject } from '../../actions.native';
  8. import { MediaState } from '../../constants';
  9. import ParticipantItem from './ParticipantItem';
  10. import styles from './styles';
  11. type Props = {
  12. /**
  13. * Participant reference
  14. */
  15. participant: Object
  16. };
  17. export const LobbyParticipantItem = ({ participant: p }: Props) => {
  18. const dispatch = useDispatch();
  19. const admit = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, true), [ dispatch ]));
  20. const openContextMenuReject = useCallback(() => dispatch(showContextMenuReject(p), [ dispatch ]));
  21. const { t } = useTranslation();
  22. return (
  23. <ParticipantItem
  24. audioMuteState = { MediaState.Muted }
  25. name = { p.name }
  26. onPress = { openContextMenuReject }
  27. participant = { p }
  28. videoMuteState = { MediaState.ForceMuted }>
  29. <Button
  30. children = { t('lobby.admit') }
  31. contentStyle = { styles.participantActionsButtonContent }
  32. labelStyle = { styles.participantActionsButtonText }
  33. mode = 'contained'
  34. onPress = { admit }
  35. style = { styles.participantActionsButtonAdmit } />
  36. </ParticipantItem>
  37. );
  38. };