您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

LobbyParticipantItem.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @flow
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useDispatch } from 'react-redux';
  5. import { approveKnockingParticipant, rejectKnockingParticipant } from '../../lobby/actions';
  6. import { ACTION_TRIGGER, MEDIA_STATE } 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(approveKnockingParticipant(p.id), [ dispatch ]));
  18. const reject = useCallback(() => dispatch(rejectKnockingParticipant(p.id), [ dispatch ]));
  19. const { t } = useTranslation();
  20. return (
  21. <ParticipantItem
  22. actionsTrigger = { ACTION_TRIGGER.PERMANENT }
  23. audioMediaState = { MEDIA_STATE.NONE }
  24. displayName = { p.name }
  25. local = { p.local }
  26. participantID = { p.id }
  27. raisedHand = { p.raisedHand }
  28. videoMuteState = { MEDIA_STATE.NONE }
  29. youText = { t('chat.you') }>
  30. <ParticipantActionButton
  31. onClick = { reject }>
  32. {t('lobby.reject')}
  33. </ParticipantActionButton>
  34. <ParticipantActionButton
  35. onClick = { admit }
  36. primary = { true }>
  37. {t('lobby.admit')}
  38. </ParticipantActionButton>
  39. </ParticipantItem>
  40. );
  41. };