2022-03-01 21:13:23 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import BBBMenu from "/imports/ui/components/common/menu/component";
|
2023-03-22 04:45:20 +08:00
|
|
|
import CreateBreakoutRoomContainer from '/imports/ui/components/actions-bar/create-breakout-room/container';
|
2022-05-20 01:28:58 +08:00
|
|
|
import Trigger from "/imports/ui/components/common/control-header/right/component";
|
2022-03-01 21:13:23 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
options: {
|
|
|
|
id: 'app.breakout.dropdown.options',
|
|
|
|
description: 'Breakout options label',
|
|
|
|
},
|
|
|
|
manageDuration: {
|
|
|
|
id: 'app.breakout.dropdown.manageDuration',
|
|
|
|
description: 'Manage duration label',
|
|
|
|
},
|
2022-03-24 21:56:07 +08:00
|
|
|
manageUsers: {
|
|
|
|
id: 'app.breakout.dropdown.manageUsers',
|
|
|
|
description: 'Manage users label',
|
|
|
|
},
|
2022-03-01 21:13:23 +08:00
|
|
|
destroy: {
|
|
|
|
id: 'app.breakout.dropdown.destroyAll',
|
|
|
|
description: 'Destroy breakouts label',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
class BreakoutDropdown extends PureComponent {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2023-03-22 04:45:20 +08:00
|
|
|
|
|
|
|
this.state = {
|
|
|
|
isCreateBreakoutRoomModalOpen: false,
|
|
|
|
};
|
|
|
|
this.setCreateBreakoutRoomModalIsOpen = this.setCreateBreakoutRoomModalIsOpen.bind(this);
|
2022-03-01 21:13:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
getAvailableActions() {
|
|
|
|
const {
|
|
|
|
intl,
|
|
|
|
openBreakoutTimeManager,
|
|
|
|
endAllBreakouts,
|
|
|
|
isMeteorConnected,
|
|
|
|
amIModerator,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
this.menuItems = [];
|
|
|
|
|
|
|
|
this.menuItems.push(
|
|
|
|
{
|
|
|
|
key: 'breakoutTimeManager',
|
|
|
|
dataTest: 'openBreakoutTimeManager',
|
|
|
|
label: intl.formatMessage(intlMessages.manageDuration),
|
|
|
|
onClick: () => {
|
|
|
|
openBreakoutTimeManager();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-03-24 21:56:07 +08:00
|
|
|
this.menuItems.push(
|
|
|
|
{
|
|
|
|
key: 'updateBreakoutUsers',
|
|
|
|
dataTest: 'openUpdateBreakoutUsersModal',
|
|
|
|
label: intl.formatMessage(intlMessages.manageUsers),
|
|
|
|
onClick: () => {
|
2023-03-22 04:45:20 +08:00
|
|
|
this.setCreateBreakoutRoomModalIsOpen(true);
|
2022-03-24 21:56:07 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2022-03-01 21:13:23 +08:00
|
|
|
if (amIModerator) {
|
|
|
|
this.menuItems.push(
|
|
|
|
{
|
|
|
|
key: 'endAllBreakouts',
|
|
|
|
dataTest: 'endAllBreakouts',
|
|
|
|
label: intl.formatMessage(intlMessages.destroy),
|
|
|
|
disabled: !isMeteorConnected,
|
|
|
|
onClick: () => {
|
|
|
|
endAllBreakouts();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return this.menuItems;
|
|
|
|
}
|
|
|
|
|
2023-03-22 04:45:20 +08:00
|
|
|
setCreateBreakoutRoomModalIsOpen(value) {
|
|
|
|
this.setState({
|
|
|
|
isCreateBreakoutRoomModalOpen: value,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-03-01 21:13:23 +08:00
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
intl,
|
2022-05-13 21:42:19 +08:00
|
|
|
isRTL,
|
2022-03-01 21:13:23 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2023-03-22 04:45:20 +08:00
|
|
|
const { isCreateBreakoutRoomModalOpen } = this.state;
|
2022-03-01 21:13:23 +08:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<BBBMenu
|
|
|
|
trigger={
|
2022-05-20 01:28:58 +08:00
|
|
|
<Trigger
|
2022-03-01 21:13:23 +08:00
|
|
|
data-test="breakoutOptionsMenu"
|
|
|
|
icon="more"
|
|
|
|
label={intl.formatMessage(intlMessages.options)}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.options)}
|
|
|
|
onClick={() => null}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
opts={{
|
2022-10-06 05:54:59 +08:00
|
|
|
id: "breakoutroom-dropdown-menu",
|
2022-03-01 21:13:23 +08:00
|
|
|
keepMounted: true,
|
|
|
|
transitionDuration: 0,
|
|
|
|
elevation: 3,
|
|
|
|
getContentAnchorEl: null,
|
|
|
|
fullwidth: "true",
|
2022-05-13 21:42:19 +08:00
|
|
|
anchorOrigin: { vertical: 'bottom', horizontal: isRTL ? 'right' : 'left' },
|
|
|
|
transformOrigin: { vertical: 'top', horizontal: isRTL ? 'right' : 'left' },
|
2022-03-01 21:13:23 +08:00
|
|
|
}}
|
|
|
|
actions={this.getAvailableActions()}
|
|
|
|
/>
|
2023-03-22 04:45:20 +08:00
|
|
|
{isCreateBreakoutRoomModalOpen ? <CreateBreakoutRoomContainer
|
|
|
|
{...{
|
|
|
|
isUpdate: true,
|
|
|
|
onRequestClose: () => this.setCreateBreakoutRoomModalIsOpen(false),
|
|
|
|
priority: "medium",
|
|
|
|
setIsOpen: this.setCreateBreakoutRoomModalIsOpen,
|
|
|
|
isOpen: isCreateBreakoutRoomModalOpen
|
|
|
|
}}
|
|
|
|
/> : null}
|
2022-03-01 21:13:23 +08:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-22 04:45:20 +08:00
|
|
|
export default injectIntl(BreakoutDropdown);
|