2021-09-14 17:31:30 +02:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
|
|
import { makeStyles } from '@material-ui/styles';
|
|
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
|
2021-11-23 15:14:59 +02:00
|
|
|
import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
|
2021-09-14 17:31:30 +02:00
|
|
|
import ParticipantPaneBaseButton from '../../../participants-pane/components/web/ParticipantPaneBaseButton';
|
|
|
|
|
import { moveToRoom } from '../../actions';
|
|
|
|
|
|
|
|
|
|
const useStyles = makeStyles(theme => {
|
|
|
|
|
return {
|
|
|
|
|
button: {
|
|
|
|
|
color: theme.palette.textError,
|
|
|
|
|
backgroundColor: 'transparent',
|
|
|
|
|
width: '100%',
|
|
|
|
|
|
|
|
|
|
'&:hover': {
|
|
|
|
|
backgroundColor: 'transparent'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
export const LeaveButton = () => {
|
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
const styles = useStyles();
|
|
|
|
|
|
|
|
|
|
const onLeave = useCallback(() => {
|
2021-11-23 15:14:59 +02:00
|
|
|
sendAnalytics(createBreakoutRoomsEvent('leave'));
|
2021-09-14 17:31:30 +02:00
|
|
|
dispatch(moveToRoom());
|
|
|
|
|
}, [ dispatch ]);
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<ParticipantPaneBaseButton
|
|
|
|
|
accessibilityLabel = { t('breakoutRooms.actions.leaveBreakoutRoom') }
|
|
|
|
|
className = { styles.button }
|
|
|
|
|
onClick = { onLeave }>
|
|
|
|
|
{t('breakoutRooms.actions.leaveBreakoutRoom')}
|
|
|
|
|
</ParticipantPaneBaseButton>
|
|
|
|
|
);
|
|
|
|
|
};
|