Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SendToRoomButton.tsx 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import React, { useCallback } from 'react';
  2. import { useTranslation } from 'react-i18next';
  3. import { useDispatch } from 'react-redux';
  4. import { createBreakoutRoomsEvent } from '../../../analytics/AnalyticsEvents';
  5. import { sendAnalytics } from '../../../analytics/functions';
  6. import { IconRingGroup } from '../../../base/icons/svg';
  7. import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem';
  8. import { sendParticipantToRoom } from '../../../breakout-rooms/actions';
  9. import { IRoom } from '../../../breakout-rooms/types';
  10. interface IProps {
  11. /**
  12. * Click handler.
  13. */
  14. onClick?: Function;
  15. /**
  16. * The ID for the participant on which the button will act.
  17. */
  18. participantID: string;
  19. /**
  20. * The room to send the participant to.
  21. */
  22. room: IRoom;
  23. }
  24. const SendToRoomButton = ({ onClick, participantID, room }: IProps) => {
  25. const dispatch = useDispatch();
  26. const { t } = useTranslation();
  27. const _onClick = useCallback(() => {
  28. onClick?.();
  29. sendAnalytics(createBreakoutRoomsEvent('send.participant.to.room'));
  30. dispatch(sendParticipantToRoom(participantID, room.id));
  31. }, [ participantID, room ]);
  32. const roomName = room.name || t('breakoutRooms.mainRoom');
  33. return (
  34. <ContextMenuItem
  35. accessibilityLabel = { roomName }
  36. icon = { IconRingGroup }
  37. onClick = { _onClick }
  38. text = { roomName } />
  39. );
  40. };
  41. export default SendToRoomButton;