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 { useDispatch } from 'react-redux';
  5. import { setKnockingParticipantApproval } from '../../lobby/actions';
  6. import { ActionTrigger, MediaState } from '../constants';
  7. import { ParticipantItem } from './ParticipantItem';
  8. import { ParticipantActionButton } from './styled';
  9. type Props = {
  10. /**
  11. * Participant reference
  12. */
  13. participant: Object
  14. };
  15. export const LobbyParticipantItem = ({ participant: p }: Props) => {
  16. const dispatch = useDispatch();
  17. const admit = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, true), [ dispatch ]));
  18. const reject = useCallback(() => dispatch(setKnockingParticipantApproval(p.id, false), [ dispatch ]));
  19. const { t } = useTranslation();
  20. return (
  21. <ParticipantItem
  22. actionsTrigger = { ActionTrigger.Permanent }
  23. audioMuteState = { MediaState.None }
  24. name = { p.name }
  25. participant = { p }
  26. videoMuteState = { MediaState.None }>
  27. <ParticipantActionButton
  28. onClick = { reject }>
  29. {t('lobby.reject')}
  30. </ParticipantActionButton>
  31. <ParticipantActionButton
  32. onClick = { admit }
  33. primary = { true }>
  34. {t('lobby.admit')}
  35. </ParticipantActionButton>
  36. </ParticipantItem>
  37. );
  38. };