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

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 { approveKnockingParticipant } from '../../../lobby/actions.native';
  7. import { showContextMenuReject } from '../../actions.native';
  8. import { MEDIA_STATE } 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(approveKnockingParticipant(p.id), [ dispatch ]));
  20. const openContextMenuReject = useCallback(() => dispatch(showContextMenuReject(p), [ dispatch ]));
  21. const { t } = useTranslation();
  22. return (
  23. <ParticipantItem
  24. audioMediaState = { MEDIA_STATE.NONE }
  25. isKnockingParticipant = { true }
  26. name = { p.name }
  27. onPress = { openContextMenuReject }
  28. participant = { p }
  29. videoMediaState = { MEDIA_STATE.NONE }>
  30. <Button
  31. children = { t('lobby.admit') }
  32. contentStyle = { styles.participantActionsButtonContent }
  33. labelStyle = { styles.participantActionsButtonText }
  34. mode = 'contained'
  35. onPress = { admit }
  36. style = { styles.participantActionsButtonAdmit } />
  37. </ParticipantItem>
  38. );
  39. };