2022-08-26 18:25:04 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
2022-09-07 08:20:05 +00:00
|
|
|
import { createToolbarEvent } from '../../../analytics/AnalyticsEvents';
|
|
|
|
import { sendAnalytics } from '../../../analytics/functions';
|
2022-08-26 18:25:04 +00:00
|
|
|
import { leaveConference } from '../../../base/conference/actions';
|
|
|
|
import Button from '../../../base/ui/components/web/Button';
|
2022-11-09 12:45:55 +00:00
|
|
|
import { BUTTON_TYPES } from '../../../base/ui/constants.web';
|
2022-08-26 18:25:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Button to leave the conference.
|
|
|
|
*
|
|
|
|
* @returns {JSX.Element} - The leave conference button.
|
|
|
|
*/
|
|
|
|
export const LeaveConferenceButton = () => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
const onLeaveConference = useCallback(() => {
|
|
|
|
sendAnalytics(createToolbarEvent('hangup'));
|
|
|
|
dispatch(leaveConference());
|
|
|
|
}, [ dispatch ]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
accessibilityLabel = { t('toolbar.accessibilityLabel.leaveConference') }
|
|
|
|
fullWidth = { true }
|
|
|
|
label = { t('toolbar.leaveConference') }
|
|
|
|
onClick = { onLeaveConference }
|
|
|
|
type = { BUTTON_TYPES.SECONDARY } />
|
|
|
|
);
|
|
|
|
};
|