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

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 { 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. onClick = { reject }
  28. style = { styles.participantActionButton }>
  29. {t('lobby.reject')}
  30. </Button>
  31. <Button
  32. onClick = { admit }
  33. style = { styles.participantActionButton }>
  34. {t('lobby.admit')}
  35. </Button>
  36. </ParticipantItem>
  37. );
  38. };