2022-07-18 13:16:08 +00:00
|
|
|
/* eslint-disable lines-around-comment */
|
2022-05-06 10:14:10 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
2022-09-07 08:20:05 +00:00
|
|
|
import { createToolbarEvent } from '../../../../analytics/AnalyticsEvents';
|
|
|
|
import { sendAnalytics } from '../../../../analytics/functions';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import { appNavigate } from '../../../../app/actions';
|
2022-07-27 08:40:34 +00:00
|
|
|
import Button from '../../../../base/ui/components/native/Button';
|
|
|
|
import { BUTTON_TYPES } from '../../../../base/ui/constants';
|
2022-05-06 10:14:10 +00:00
|
|
|
|
|
|
|
import EndMeetingIcon from './EndMeetingIcon';
|
2022-07-18 13:16:08 +00:00
|
|
|
// @ts-ignore
|
2022-05-06 10:14:10 +00:00
|
|
|
import styles from './styles';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Button for ending meeting from carmode.
|
|
|
|
*
|
|
|
|
* @returns {JSX.Element} - The end meeting button.
|
|
|
|
*/
|
2022-09-08 09:52:36 +00:00
|
|
|
const EndMeetingButton = (): JSX.Element => {
|
2022-05-06 10:14:10 +00:00
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
const onSelect = useCallback(() => {
|
|
|
|
sendAnalytics(createToolbarEvent('hangup'));
|
|
|
|
|
|
|
|
dispatch(appNavigate(undefined));
|
|
|
|
}, [ dispatch ]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
2022-08-26 18:25:04 +00:00
|
|
|
accessibilityLabel = 'toolbar.accessibilityLabel.leaveConference'
|
2022-05-06 10:14:10 +00:00
|
|
|
icon = { EndMeetingIcon }
|
2022-08-26 18:25:04 +00:00
|
|
|
labelKey = 'toolbar.leaveConference'
|
2022-08-22 09:40:59 +00:00
|
|
|
onClick = { onSelect }
|
2022-07-07 12:29:18 +00:00
|
|
|
style = { styles.endMeetingButton }
|
|
|
|
type = { BUTTON_TYPES.DESTRUCTIVE } />
|
2022-05-06 10:14:10 +00:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default EndMeetingButton;
|