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

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