2022-08-26 18:25:04 +00:00
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
2022-10-19 08:42:54 +00:00
|
|
|
import { endConference } from '../../../base/conference/actions';
|
2022-10-11 10:47:54 +00:00
|
|
|
import { isLocalParticipantModerator } from '../../../base/participants/functions';
|
2022-08-26 18:25:04 +00:00
|
|
|
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
|
|
|
import { isInBreakoutRoom } from '../../../breakout-rooms/functions';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Button to end the conference for all participants.
|
|
|
|
*
|
|
|
|
* @returns {JSX.Element} - The end conference button.
|
|
|
|
*/
|
|
|
|
export const EndConferenceButton = () => {
|
|
|
|
const { t } = useTranslation();
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const _isLocalParticipantModerator = useSelector(isLocalParticipantModerator);
|
|
|
|
const _isInBreakoutRoom = useSelector(isInBreakoutRoom);
|
|
|
|
|
|
|
|
const onEndConference = useCallback(() => {
|
|
|
|
dispatch(endConference());
|
|
|
|
}, [ dispatch ]);
|
|
|
|
|
|
|
|
return (<>
|
|
|
|
{ !_isInBreakoutRoom && _isLocalParticipantModerator && <Button
|
|
|
|
accessibilityLabel = { t('toolbar.accessibilityLabel.endConference') }
|
|
|
|
fullWidth = { true }
|
|
|
|
label = { t('toolbar.endConference') }
|
|
|
|
onClick = { onEndConference }
|
|
|
|
type = { BUTTON_TYPES.DESTRUCTIVE } /> }
|
|
|
|
</>);
|
|
|
|
};
|