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.

LeaveBreakoutRoomButton.tsx 1.1KB

123456789101112131415161718192021222324252627282930313233343536
  1. import React, { useCallback } from 'react';
  2. import { useDispatch } from 'react-redux';
  3. import { createBreakoutRoomsEvent } from '../../../analytics/AnalyticsEvents';
  4. import { sendAnalytics } from '../../../analytics/functions';
  5. import Button from '../../../base/ui/components/native/Button';
  6. import { BUTTON_TYPES } from '../../../base/ui/constants.native';
  7. import { moveToRoom } from '../../actions';
  8. import styles from './styles';
  9. /**
  10. * Button to leave a breakout rooms.
  11. *
  12. * @returns {JSX.Element} - The leave breakout room button.
  13. */
  14. const LeaveBreakoutRoomButton = () => {
  15. const dispatch = useDispatch();
  16. const onLeave = useCallback(() => {
  17. sendAnalytics(createBreakoutRoomsEvent('leave'));
  18. dispatch(moveToRoom());
  19. }
  20. , [ dispatch ]);
  21. return (
  22. <Button
  23. accessibilityLabel = 'breakoutRooms.actions.leaveBreakoutRoom'
  24. labelKey = 'breakoutRooms.actions.leaveBreakoutRoom'
  25. onClick = { onLeave }
  26. style = { styles.button }
  27. type = { BUTTON_TYPES.DESTRUCTIVE } />
  28. );
  29. };
  30. export default LeaveBreakoutRoomButton;