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

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