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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // @flow
  2. import React from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { ACTION_TRIGGER, MEDIA_STATE } from '../../constants';
  5. import { useLobbyActions } from '../../hooks';
  6. import ParticipantItem from './ParticipantItem';
  7. import { ParticipantActionButton } from './styled';
  8. type Props = {
  9. /**
  10. * If an overflow drawer should be displayed.
  11. */
  12. overflowDrawer: boolean,
  13. /**
  14. * Callback used to open a drawer with admit/reject actions.
  15. */
  16. openDrawerForParticipant: Function,
  17. /**
  18. * Participant reference
  19. */
  20. participant: Object
  21. };
  22. export const LobbyParticipantItem = ({
  23. overflowDrawer,
  24. participant: p,
  25. openDrawerForParticipant
  26. }: Props) => {
  27. const { id } = p;
  28. const [ admit, reject ] = useLobbyActions({ participantID: id });
  29. const { t } = useTranslation();
  30. return (
  31. <ParticipantItem
  32. actionsTrigger = { ACTION_TRIGGER.PERMANENT }
  33. audioMediaState = { MEDIA_STATE.NONE }
  34. displayName = { p.name }
  35. local = { p.local }
  36. openDrawerForParticipant = { openDrawerForParticipant }
  37. overflowDrawer = { overflowDrawer }
  38. participantID = { id }
  39. raisedHand = { p.raisedHand }
  40. videoMediaState = { MEDIA_STATE.NONE }
  41. youText = { t('chat.you') }>
  42. <ParticipantActionButton
  43. onClick = { reject }
  44. primary = { false }>
  45. {t('lobby.reject')}
  46. </ParticipantActionButton>
  47. <ParticipantActionButton
  48. onClick = { admit }
  49. primary = { true }>
  50. {t('lobby.admit')}
  51. </ParticipantActionButton>
  52. </ParticipantItem>
  53. );
  54. };