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.

LeaveConferenceButton.tsx 1.1KB

1234567891011121314151617181920212223242526272829303132333435
  1. /* eslint-disable lines-around-comment */
  2. import React, { useCallback } from 'react';
  3. import { useTranslation } from 'react-i18next';
  4. import { useDispatch } from 'react-redux';
  5. // @ts-ignore
  6. import { createToolbarEvent, sendAnalytics } from '../../../analytics';
  7. // @ts-ignore
  8. import { leaveConference } from '../../../base/conference/actions';
  9. import Button from '../../../base/ui/components/web/Button';
  10. import { BUTTON_TYPES } from '../../../base/ui/constants';
  11. /**
  12. * Button to leave the conference.
  13. *
  14. * @returns {JSX.Element} - The leave conference button.
  15. */
  16. export const LeaveConferenceButton = () => {
  17. const { t } = useTranslation();
  18. const dispatch = useDispatch();
  19. const onLeaveConference = useCallback(() => {
  20. sendAnalytics(createToolbarEvent('hangup'));
  21. dispatch(leaveConference());
  22. }, [ dispatch ]);
  23. return (
  24. <Button
  25. accessibilityLabel = { t('toolbar.accessibilityLabel.leaveConference') }
  26. fullWidth = { true }
  27. label = { t('toolbar.leaveConference') }
  28. onClick = { onLeaveConference }
  29. type = { BUTTON_TYPES.SECONDARY } />
  30. );
  31. };