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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 { MediaState } from '../../constants';
  8. import ParticipantItem from './ParticipantItem';
  9. import styles from './styles';
  10. type Props = {
  11. /**
  12. * Participant reference
  13. */
  14. participant: Object
  15. };
  16. export const LobbyParticipantItem = ({ participant: p }: Props) => {
  17. const dispatch = useDispatch();
  18. const admit = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, true), [ dispatch ]));
  19. const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
  20. const { t } = useTranslation();
  21. return (
  22. <ParticipantItem
  23. audioMuteState = { MediaState.None }
  24. participant = { p }
  25. videoMuteState = { MediaState.None }>
  26. <Button
  27. mode = 'contained'
  28. onPress = { reject }
  29. style = { styles.participantActionButton }>
  30. {t('lobby.reject')}
  31. </Button>
  32. <Button
  33. onPress = { admit }
  34. style = { styles.participantActionButton }>
  35. {t('lobby.admit')}
  36. </Button>
  37. </ParticipantItem>
  38. );
  39. };