Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

LeaveConferenceButton.tsx 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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_TYPES } from '../../../base/ui/constants.web';
  8. import { HangupContextMenuItem } from './HangupContextMenuItem';
  9. /**
  10. * The type of the React {@code Component} props of {@link LeaveConferenceButton}.
  11. */
  12. type Props = {
  13. /**
  14. * Key to use for toolbarButtonClicked event.
  15. */
  16. buttonKey: string;
  17. /**
  18. * Notify mode for `toolbarButtonClicked` event -
  19. * whether to only notify or to also prevent button click routine.
  20. */
  21. notifyMode?: string;
  22. };
  23. /**
  24. * Button to leave the conference.
  25. *
  26. * @param {Object} props - Component's props.
  27. * @returns {JSX.Element} - The leave conference button.
  28. */
  29. export const LeaveConferenceButton = (props: Props) => {
  30. const { t } = useTranslation();
  31. const dispatch = useDispatch();
  32. const onLeaveConference = useCallback(() => {
  33. sendAnalytics(createToolbarEvent('hangup'));
  34. dispatch(leaveConference());
  35. }, [ dispatch ]);
  36. return (
  37. <HangupContextMenuItem
  38. accessibilityLabel = { t('toolbar.accessibilityLabel.leaveConference') }
  39. buttonKey = { props.buttonKey }
  40. buttonType = { BUTTON_TYPES.SECONDARY }
  41. label = { t('toolbar.leaveConference') }
  42. notifyMode = { props.notifyMode }
  43. onClick = { onLeaveConference } />
  44. );
  45. };