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.

EndConferenceButton.tsx 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* eslint-disable lines-around-comment */
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useDispatch, useSelector } from 'react-redux';
  5. // @ts-ignore
  6. import { endConference } from '../../../base/conference';
  7. // @ts-ignore
  8. import { isLocalParticipantModerator } from '../../../base/participants';
  9. import Button from '../../../base/ui/components/web/Button';
  10. import { BUTTON_TYPES } from '../../../base/ui/constants';
  11. // @ts-ignore
  12. import { isInBreakoutRoom } from '../../../breakout-rooms/functions';
  13. /**
  14. * Button to end the conference for all participants.
  15. *
  16. * @returns {JSX.Element} - The end conference button.
  17. */
  18. export const EndConferenceButton = () => {
  19. const { t } = useTranslation();
  20. const dispatch = useDispatch();
  21. const _isLocalParticipantModerator = useSelector(isLocalParticipantModerator);
  22. const _isInBreakoutRoom = useSelector(isInBreakoutRoom);
  23. const onEndConference = useCallback(() => {
  24. dispatch(endConference());
  25. }, [ dispatch ]);
  26. return (<>
  27. { !_isInBreakoutRoom && _isLocalParticipantModerator && <Button
  28. accessibilityLabel = { t('toolbar.accessibilityLabel.endConference') }
  29. fullWidth = { true }
  30. label = { t('toolbar.endConference') }
  31. onClick = { onEndConference }
  32. type = { BUTTON_TYPES.DESTRUCTIVE } /> }
  33. </>);
  34. };