2020-03-25 20:52:23 +08:00
|
|
|
import React, { Component } from 'react';
|
2018-12-18 23:15:51 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2018-11-20 07:29:48 +08:00
|
|
|
import BreakoutRoomContainer from '/imports/ui/components/breakout-room/container';
|
|
|
|
import UserListContainer from '/imports/ui/components/user-list/container';
|
|
|
|
import ChatContainer from '/imports/ui/components/chat/container';
|
2018-12-13 04:10:27 +08:00
|
|
|
import NoteContainer from '/imports/ui/components/note/container';
|
2018-11-20 07:29:48 +08:00
|
|
|
import PollContainer from '/imports/ui/components/poll/container';
|
2019-05-29 22:31:27 +08:00
|
|
|
import CaptionsContainer from '/imports/ui/components/captions/pad/container';
|
2019-02-27 01:08:15 +08:00
|
|
|
import WaitingUsersPanel from '/imports/ui/components/waiting-users/container';
|
2018-11-20 07:29:48 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
import Resizable from 're-resizable';
|
|
|
|
import { styles } from '/imports/ui/components/app/styles';
|
2018-11-20 23:28:00 +08:00
|
|
|
import _ from 'lodash';
|
2020-03-25 20:52:23 +08:00
|
|
|
import { withLayoutConsumer } from '/imports/ui/components/layout/context';
|
|
|
|
import {
|
|
|
|
USERLIST_MIN_WIDTH,
|
|
|
|
USERLIST_MAX_WIDTH,
|
|
|
|
CHAT_MIN_WIDTH,
|
|
|
|
CHAT_MAX_WIDTH,
|
2021-03-02 20:24:03 +08:00
|
|
|
POLL_MIN_WIDTH,
|
|
|
|
POLL_MAX_WIDTH,
|
|
|
|
NOTE_MIN_WIDTH,
|
|
|
|
NOTE_MAX_WIDTH,
|
2021-04-17 05:02:47 +08:00
|
|
|
} from '/imports/ui/components/layout/layout-manager/component';
|
2018-11-20 07:29:48 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
chatLabel: {
|
|
|
|
id: 'app.chat.label',
|
|
|
|
description: 'Aria-label for Chat Section',
|
|
|
|
},
|
2018-12-13 04:10:27 +08:00
|
|
|
noteLabel: {
|
|
|
|
id: 'app.note.label',
|
|
|
|
description: 'Aria-label for Note Section',
|
|
|
|
},
|
2019-05-17 04:11:10 +08:00
|
|
|
captionsLabel: {
|
|
|
|
id: 'app.captions.label',
|
|
|
|
description: 'Aria-label for Captions Section',
|
|
|
|
},
|
2018-11-20 07:29:48 +08:00
|
|
|
userListLabel: {
|
|
|
|
id: 'app.userList.label',
|
|
|
|
description: 'Aria-label for Userlist Nav',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-12-18 23:15:51 +08:00
|
|
|
const propTypes = {
|
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
|
|
|
enableResize: PropTypes.bool.isRequired,
|
|
|
|
openPanel: PropTypes.string.isRequired,
|
|
|
|
};
|
|
|
|
|
2019-03-28 23:58:10 +08:00
|
|
|
const DEFAULT_PANEL_WIDTH = 340;
|
|
|
|
|
2018-12-19 09:33:19 +08:00
|
|
|
// Variables for resizing user-list.
|
2020-03-25 20:52:23 +08:00
|
|
|
const USERLIST_MIN_WIDTH_PX = USERLIST_MIN_WIDTH;
|
|
|
|
const USERLIST_MAX_WIDTH_PX = USERLIST_MAX_WIDTH;
|
2018-12-19 09:33:19 +08:00
|
|
|
|
2019-05-17 04:11:10 +08:00
|
|
|
// Variables for resizing captions.
|
|
|
|
const CAPTIONS_MIN_WIDTH = DEFAULT_PANEL_WIDTH;
|
|
|
|
const CAPTIONS_MAX_WIDTH = 400;
|
|
|
|
|
2019-04-02 23:30:35 +08:00
|
|
|
// Variables for resizing waiting users.
|
2020-08-19 05:53:05 +08:00
|
|
|
const WAITING_MIN_WIDTH = 300;
|
|
|
|
const WAITING_MAX_WIDTH = 350;
|
2019-04-02 23:30:35 +08:00
|
|
|
|
2020-03-25 20:52:23 +08:00
|
|
|
class PanelManager extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-11-20 23:28:00 +08:00
|
|
|
|
2018-11-21 03:18:30 +08:00
|
|
|
this.padKey = _.uniqueId('resize-pad-');
|
|
|
|
this.userlistKey = _.uniqueId('userlist-');
|
|
|
|
this.breakoutroomKey = _.uniqueId('breakoutroom-');
|
|
|
|
this.chatKey = _.uniqueId('chat-');
|
|
|
|
this.pollKey = _.uniqueId('poll-');
|
2018-12-13 04:10:27 +08:00
|
|
|
this.noteKey = _.uniqueId('note-');
|
2019-05-17 04:11:10 +08:00
|
|
|
this.captionsKey = _.uniqueId('captions-');
|
2019-02-27 01:08:15 +08:00
|
|
|
this.waitingUsers = _.uniqueId('waitingUsers-');
|
2018-12-19 09:33:19 +08:00
|
|
|
|
2020-03-25 20:52:23 +08:00
|
|
|
const { layoutContextState } = props;
|
|
|
|
const { userListSize, chatSize } = layoutContextState;
|
|
|
|
|
2018-12-19 09:33:19 +08:00
|
|
|
this.state = {
|
2020-03-25 20:52:23 +08:00
|
|
|
userlistWidth: userListSize.width,
|
2020-06-20 13:46:10 +08:00
|
|
|
chatWidth: chatSize.width,
|
2019-03-28 23:58:10 +08:00
|
|
|
noteWidth: DEFAULT_PANEL_WIDTH,
|
2019-05-17 04:11:10 +08:00
|
|
|
captionsWidth: DEFAULT_PANEL_WIDTH,
|
2020-06-20 13:46:10 +08:00
|
|
|
pollWidth: DEFAULT_PANEL_WIDTH,
|
2019-04-03 01:52:05 +08:00
|
|
|
waitingWidth: DEFAULT_PANEL_WIDTH,
|
2020-06-20 13:46:10 +08:00
|
|
|
breakoutRoomWidth: 0,
|
2018-12-19 09:33:19 +08:00
|
|
|
};
|
2020-03-25 20:52:23 +08:00
|
|
|
|
|
|
|
this.setUserListWidth = this.setUserListWidth.bind(this);
|
2020-03-25 20:52:23 +08:00
|
|
|
}
|
2019-03-28 03:49:19 +08:00
|
|
|
|
2020-03-25 20:52:23 +08:00
|
|
|
componentDidUpdate(prevProps) {
|
2020-06-20 13:46:10 +08:00
|
|
|
const {
|
|
|
|
userlistWidth,
|
|
|
|
chatWidth,
|
|
|
|
noteWidth,
|
|
|
|
captionsWidth,
|
|
|
|
pollWidth,
|
|
|
|
waitingWidth,
|
|
|
|
breakoutRoomWidth,
|
|
|
|
} = this.state;
|
2020-03-25 20:52:23 +08:00
|
|
|
const { layoutContextState } = this.props;
|
2020-06-20 13:46:10 +08:00
|
|
|
const {
|
|
|
|
userListSize,
|
|
|
|
chatSize,
|
|
|
|
noteSize,
|
|
|
|
captionsSize,
|
|
|
|
pollSize,
|
|
|
|
waitingSize,
|
|
|
|
breakoutRoomSize,
|
|
|
|
} = layoutContextState;
|
2020-03-25 20:52:23 +08:00
|
|
|
const { layoutContextState: oldLayoutContextState } = prevProps;
|
2020-06-20 13:46:10 +08:00
|
|
|
const {
|
|
|
|
userListSize: oldUserListSize,
|
|
|
|
chatSize: oldChatSize,
|
|
|
|
noteSize: oldNoteSize,
|
|
|
|
captionsSize: oldCaptionsSize,
|
|
|
|
pollSize: oldPollSize,
|
|
|
|
waitingSize: oldWaitingSize,
|
|
|
|
breakoutRoomSize: oldBreakoutRoomSize,
|
|
|
|
} = oldLayoutContextState;
|
2020-03-25 20:52:23 +08:00
|
|
|
|
|
|
|
if (userListSize.width !== oldUserListSize.width && userListSize.width !== userlistWidth) {
|
|
|
|
this.setUserListWidth(userListSize.width);
|
2020-07-16 00:44:59 +08:00
|
|
|
}
|
2020-03-25 20:52:23 +08:00
|
|
|
if (chatSize.width !== oldChatSize.width && chatSize.width !== chatWidth) {
|
|
|
|
this.setChatWidth(chatSize.width);
|
|
|
|
}
|
2020-06-20 13:46:10 +08:00
|
|
|
if (noteSize.width !== oldNoteSize.width && noteSize.width !== noteWidth) {
|
|
|
|
this.setNoteWidth(noteSize.width);
|
|
|
|
}
|
|
|
|
if (captionsSize.width !== oldCaptionsSize.width && captionsSize.width !== captionsWidth) {
|
|
|
|
this.setCaptionsWidth(captionsSize.width);
|
|
|
|
}
|
|
|
|
if (pollSize.width !== oldPollSize.width && pollSize.width !== pollWidth) {
|
|
|
|
this.setPollWidth(pollSize.width);
|
|
|
|
}
|
|
|
|
if (waitingSize.width !== oldWaitingSize.width && waitingSize.width !== waitingWidth) {
|
|
|
|
this.setWaitingWidth(waitingSize.width);
|
|
|
|
}
|
|
|
|
if (breakoutRoomSize.width !== oldBreakoutRoomSize.width
|
|
|
|
&& breakoutRoomSize.width !== breakoutRoomWidth) {
|
|
|
|
this.setBreakoutRoomWidth(breakoutRoomSize.width);
|
|
|
|
}
|
2020-03-25 20:52:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
setUserListWidth(userlistWidth) {
|
|
|
|
this.setState({ userlistWidth });
|
|
|
|
}
|
|
|
|
|
|
|
|
setChatWidth(chatWidth) {
|
|
|
|
this.setState({ chatWidth });
|
|
|
|
}
|
|
|
|
|
2020-06-20 13:46:10 +08:00
|
|
|
setNoteWidth(noteWidth) {
|
|
|
|
this.setState({ noteWidth });
|
|
|
|
}
|
|
|
|
|
|
|
|
setCaptionsWidth(captionsWidth) {
|
|
|
|
this.setState({ captionsWidth });
|
|
|
|
}
|
|
|
|
|
|
|
|
setPollWidth(pollWidth) {
|
|
|
|
this.setState({ pollWidth });
|
|
|
|
}
|
|
|
|
|
|
|
|
setWaitingWidth(waitingWidth) {
|
|
|
|
this.setState({ waitingWidth });
|
|
|
|
}
|
|
|
|
|
|
|
|
setBreakoutRoomWidth(breakoutRoomWidth) {
|
|
|
|
this.setState({ breakoutRoomWidth });
|
|
|
|
}
|
|
|
|
|
2020-03-25 20:52:23 +08:00
|
|
|
userListResizeStop(addvalue) {
|
|
|
|
const { userlistWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
2020-06-20 13:46:10 +08:00
|
|
|
this.setUserListWidth(userlistWidth + addvalue);
|
2020-03-25 20:52:23 +08:00
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setUserListSize',
|
|
|
|
value: {
|
|
|
|
width: userlistWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
2020-06-20 13:46:10 +08:00
|
|
|
window.dispatchEvent(new Event('panelChanged'));
|
2020-03-25 20:52:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
chatResizeStop(addvalue) {
|
|
|
|
const { chatWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
2020-06-20 13:46:10 +08:00
|
|
|
this.setChatWidth(chatWidth + addvalue);
|
2020-03-25 20:52:23 +08:00
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setChatSize',
|
|
|
|
value: {
|
|
|
|
width: chatWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
2020-06-20 13:46:10 +08:00
|
|
|
window.dispatchEvent(new Event('panelChanged'));
|
|
|
|
}
|
|
|
|
|
|
|
|
noteResizeStop(addvalue) {
|
|
|
|
const { noteWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
this.setNoteWidth(noteWidth + addvalue);
|
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setNoteSize',
|
|
|
|
value: {
|
|
|
|
width: noteWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
window.dispatchEvent(new Event('panelChanged'));
|
|
|
|
}
|
|
|
|
|
|
|
|
captionsResizeStop(addvalue) {
|
|
|
|
const { captionsWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
this.setCaptionsWidth(captionsWidth + addvalue);
|
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setCaptionsSize',
|
|
|
|
value: {
|
|
|
|
width: captionsWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
window.dispatchEvent(new Event('panelChanged'));
|
|
|
|
}
|
|
|
|
|
|
|
|
pollResizeStop(addvalue) {
|
|
|
|
const { pollWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
this.setPollWidth(pollWidth + addvalue);
|
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setPollSize',
|
|
|
|
value: {
|
|
|
|
width: pollWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
window.dispatchEvent(new Event('panelChanged'));
|
|
|
|
}
|
|
|
|
|
|
|
|
waitingResizeStop(addvalue) {
|
|
|
|
const { waitingWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
this.setWaitingWidth(waitingWidth + addvalue);
|
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setWaitingUsersPanelSize',
|
|
|
|
value: {
|
|
|
|
width: waitingWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
window.dispatchEvent(new Event('panelChanged'));
|
2019-03-28 03:49:19 +08:00
|
|
|
}
|
|
|
|
|
2018-11-20 07:29:48 +08:00
|
|
|
renderUserList() {
|
|
|
|
const {
|
|
|
|
intl,
|
2018-11-21 03:18:30 +08:00
|
|
|
enableResize,
|
2019-05-16 06:51:43 +08:00
|
|
|
openPanel,
|
|
|
|
shouldAriaHide,
|
2018-11-20 07:29:48 +08:00
|
|
|
} = this.props;
|
|
|
|
|
2019-05-16 06:51:43 +08:00
|
|
|
const ariaHidden = shouldAriaHide() && openPanel !== 'userlist';
|
|
|
|
|
2018-11-20 07:29:48 +08:00
|
|
|
return (
|
|
|
|
<div
|
2018-11-21 03:18:30 +08:00
|
|
|
className={styles.userList}
|
2018-11-20 07:29:48 +08:00
|
|
|
aria-label={intl.formatMessage(intlMessages.userListLabel)}
|
2018-11-21 03:18:30 +08:00
|
|
|
key={enableResize ? null : this.userlistKey}
|
2019-05-16 06:51:43 +08:00
|
|
|
aria-hidden={ariaHidden}
|
2018-11-20 07:29:48 +08:00
|
|
|
>
|
|
|
|
<UserListContainer />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderUserListResizable() {
|
2018-12-19 09:33:19 +08:00
|
|
|
const { userlistWidth } = this.state;
|
2019-07-16 03:15:58 +08:00
|
|
|
const { isRTL } = this.props;
|
2018-11-20 07:29:48 +08:00
|
|
|
|
|
|
|
const resizableEnableOptions = {
|
|
|
|
top: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
right: !isRTL,
|
2018-11-20 07:29:48 +08:00
|
|
|
bottom: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
left: !!isRTL,
|
2018-11-20 07:29:48 +08:00
|
|
|
topRight: false,
|
|
|
|
bottomRight: false,
|
|
|
|
bottomLeft: false,
|
|
|
|
topLeft: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Resizable
|
|
|
|
minWidth={USERLIST_MIN_WIDTH_PX}
|
|
|
|
maxWidth={USERLIST_MAX_WIDTH_PX}
|
|
|
|
ref={(node) => { this.resizableUserList = node; }}
|
|
|
|
enable={resizableEnableOptions}
|
2018-11-21 03:18:30 +08:00
|
|
|
key={this.userlistKey}
|
2018-12-19 09:33:19 +08:00
|
|
|
size={{ width: userlistWidth }}
|
|
|
|
onResizeStop={(e, direction, ref, d) => {
|
2020-03-25 20:52:23 +08:00
|
|
|
this.userListResizeStop(d.width);
|
2018-12-19 09:33:19 +08:00
|
|
|
}}
|
2018-11-20 07:29:48 +08:00
|
|
|
>
|
|
|
|
{this.renderUserList()}
|
|
|
|
</Resizable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderChat() {
|
2018-11-21 03:18:30 +08:00
|
|
|
const { intl, enableResize } = this.props;
|
2018-11-20 07:29:48 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<section
|
2021-04-18 23:44:02 +08:00
|
|
|
id="chatPanel"
|
2018-11-20 07:29:48 +08:00
|
|
|
className={styles.chat}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.chatLabel)}
|
2018-11-21 03:18:30 +08:00
|
|
|
key={enableResize ? null : this.chatKey}
|
2018-11-20 07:29:48 +08:00
|
|
|
>
|
|
|
|
<ChatContainer />
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderChatResizable() {
|
2018-12-19 09:33:19 +08:00
|
|
|
const { chatWidth } = this.state;
|
2019-07-16 03:15:58 +08:00
|
|
|
const { isRTL } = this.props;
|
2018-11-20 07:29:48 +08:00
|
|
|
|
|
|
|
const resizableEnableOptions = {
|
|
|
|
top: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
right: !isRTL,
|
2018-11-20 07:29:48 +08:00
|
|
|
bottom: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
left: !!isRTL,
|
2018-11-20 07:29:48 +08:00
|
|
|
topRight: false,
|
|
|
|
bottomRight: false,
|
|
|
|
bottomLeft: false,
|
|
|
|
topLeft: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Resizable
|
|
|
|
minWidth={CHAT_MIN_WIDTH}
|
|
|
|
maxWidth={CHAT_MAX_WIDTH}
|
|
|
|
ref={(node) => { this.resizableChat = node; }}
|
|
|
|
enable={resizableEnableOptions}
|
2018-11-21 03:18:30 +08:00
|
|
|
key={this.chatKey}
|
2018-12-19 09:33:19 +08:00
|
|
|
size={{ width: chatWidth }}
|
|
|
|
onResizeStop={(e, direction, ref, d) => {
|
2020-03-25 20:52:23 +08:00
|
|
|
this.chatResizeStop(d.width);
|
2018-12-19 09:33:19 +08:00
|
|
|
}}
|
2018-11-20 07:29:48 +08:00
|
|
|
>
|
|
|
|
{this.renderChat()}
|
|
|
|
</Resizable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-12-13 04:10:27 +08:00
|
|
|
renderNote() {
|
|
|
|
const { intl, enableResize } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section
|
2021-04-18 23:44:02 +08:00
|
|
|
id="notePanel"
|
2018-12-13 04:10:27 +08:00
|
|
|
className={styles.note}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.noteLabel)}
|
|
|
|
key={enableResize ? null : this.noteKey}
|
|
|
|
>
|
|
|
|
<NoteContainer />
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderNoteResizable() {
|
|
|
|
const { noteWidth } = this.state;
|
2019-07-16 03:15:58 +08:00
|
|
|
const { isRTL } = this.props;
|
2018-12-13 04:10:27 +08:00
|
|
|
|
|
|
|
const resizableEnableOptions = {
|
|
|
|
top: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
right: !isRTL,
|
2018-12-13 04:10:27 +08:00
|
|
|
bottom: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
left: !!isRTL,
|
2018-12-13 04:10:27 +08:00
|
|
|
topRight: false,
|
|
|
|
bottomRight: false,
|
|
|
|
bottomLeft: false,
|
|
|
|
topLeft: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Resizable
|
|
|
|
minWidth={NOTE_MIN_WIDTH}
|
|
|
|
maxWidth={NOTE_MAX_WIDTH}
|
|
|
|
ref={(node) => { this.resizableNote = node; }}
|
|
|
|
enable={resizableEnableOptions}
|
|
|
|
key={this.noteKey}
|
|
|
|
size={{ width: noteWidth }}
|
|
|
|
onResizeStop={(e, direction, ref, d) => {
|
2020-06-20 13:46:10 +08:00
|
|
|
this.noteResizeStop(d.width);
|
2018-12-13 04:10:27 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.renderNote()}
|
|
|
|
</Resizable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-05-17 04:11:10 +08:00
|
|
|
renderCaptions() {
|
|
|
|
const { intl, enableResize } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section
|
2021-04-18 23:44:02 +08:00
|
|
|
id="captionsPanel"
|
2019-05-17 04:11:10 +08:00
|
|
|
className={styles.captions}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.captionsLabel)}
|
|
|
|
key={enableResize ? null : this.captionsKey}
|
|
|
|
>
|
|
|
|
<CaptionsContainer />
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderCaptionsResizable() {
|
|
|
|
const { captionsWidth } = this.state;
|
2019-07-16 03:15:58 +08:00
|
|
|
const { isRTL } = this.props;
|
2019-05-17 04:11:10 +08:00
|
|
|
|
|
|
|
const resizableEnableOptions = {
|
|
|
|
top: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
right: !isRTL,
|
2019-05-17 04:11:10 +08:00
|
|
|
bottom: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
left: !!isRTL,
|
2019-05-17 04:11:10 +08:00
|
|
|
topRight: false,
|
|
|
|
bottomRight: false,
|
|
|
|
bottomLeft: false,
|
|
|
|
topLeft: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Resizable
|
|
|
|
minWidth={CAPTIONS_MIN_WIDTH}
|
|
|
|
maxWidth={CAPTIONS_MAX_WIDTH}
|
|
|
|
ref={(node) => { this.resizableCaptions = node; }}
|
|
|
|
enable={resizableEnableOptions}
|
|
|
|
key={this.captionsKey}
|
|
|
|
size={{ width: captionsWidth }}
|
|
|
|
onResizeStop={(e, direction, ref, d) => {
|
2021-04-12 22:51:01 +08:00
|
|
|
this.captionsResizeStop(d.width);
|
2019-05-17 04:11:10 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.renderCaptions()}
|
|
|
|
</Resizable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-02-27 01:08:15 +08:00
|
|
|
renderWaitingUsersPanel() {
|
|
|
|
const { intl, enableResize } = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<section
|
2021-04-18 23:44:02 +08:00
|
|
|
id="waitingUsersPanelPanel"
|
2019-02-27 01:08:15 +08:00
|
|
|
className={styles.note}
|
|
|
|
aria-label={intl.formatMessage(intlMessages.noteLabel)}
|
|
|
|
key={enableResize ? null : this.waitingUsers}
|
|
|
|
>
|
|
|
|
<WaitingUsersPanel />
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderWaitingUsersPanelResizable() {
|
2019-04-02 23:30:35 +08:00
|
|
|
const { waitingWidth } = this.state;
|
2019-07-16 03:15:58 +08:00
|
|
|
const { isRTL } = this.props;
|
2019-02-27 01:08:15 +08:00
|
|
|
|
|
|
|
const resizableEnableOptions = {
|
|
|
|
top: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
right: !isRTL,
|
2019-02-27 01:08:15 +08:00
|
|
|
bottom: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
left: !!isRTL,
|
2019-02-27 01:08:15 +08:00
|
|
|
topRight: false,
|
|
|
|
bottomRight: false,
|
|
|
|
bottomLeft: false,
|
|
|
|
topLeft: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Resizable
|
2019-04-02 23:30:35 +08:00
|
|
|
minWidth={WAITING_MIN_WIDTH}
|
|
|
|
maxWidth={WAITING_MAX_WIDTH}
|
2019-02-27 01:08:15 +08:00
|
|
|
ref={(node) => { this.resizableWaitingUsersPanel = node; }}
|
|
|
|
enable={resizableEnableOptions}
|
2019-04-02 23:30:35 +08:00
|
|
|
key={this.waitingUsers}
|
|
|
|
size={{ width: waitingWidth }}
|
2019-02-27 01:08:15 +08:00
|
|
|
onResizeStop={(e, direction, ref, d) => {
|
2021-04-12 22:51:01 +08:00
|
|
|
this.waitingResizeStop(d.width);
|
2019-02-27 01:08:15 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.renderWaitingUsersPanel()}
|
|
|
|
</Resizable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-28 23:58:10 +08:00
|
|
|
renderBreakoutRoom() {
|
2020-06-20 13:46:10 +08:00
|
|
|
const { breakoutRoomWidth } = this.state;
|
2019-03-28 23:58:10 +08:00
|
|
|
return (
|
2020-06-20 13:46:10 +08:00
|
|
|
<div
|
2021-04-18 23:44:02 +08:00
|
|
|
id="breakoutroomPanel"
|
2020-06-20 13:46:10 +08:00
|
|
|
className={styles.breakoutRoom}
|
|
|
|
key={this.breakoutroomKey}
|
|
|
|
style={{
|
|
|
|
width: breakoutRoomWidth,
|
|
|
|
}}
|
|
|
|
>
|
2019-03-28 23:58:10 +08:00
|
|
|
<BreakoutRoomContainer />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-11-20 07:29:48 +08:00
|
|
|
renderPoll() {
|
|
|
|
return (
|
2021-04-18 23:44:02 +08:00
|
|
|
<div className={styles.poll} key={this.pollKey} id="pollPanel">
|
2018-11-20 07:29:48 +08:00
|
|
|
<PollContainer />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-28 23:58:10 +08:00
|
|
|
renderPollResizable() {
|
|
|
|
const { pollWidth } = this.state;
|
2019-07-16 03:15:58 +08:00
|
|
|
const { isRTL } = this.props;
|
2019-03-28 23:58:10 +08:00
|
|
|
|
|
|
|
const resizableEnableOptions = {
|
|
|
|
top: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
right: !isRTL,
|
2019-03-28 23:58:10 +08:00
|
|
|
bottom: false,
|
2019-07-16 03:15:58 +08:00
|
|
|
left: !!isRTL,
|
2019-03-28 23:58:10 +08:00
|
|
|
topRight: false,
|
|
|
|
bottomRight: false,
|
|
|
|
bottomLeft: false,
|
|
|
|
topLeft: false,
|
|
|
|
};
|
|
|
|
|
2018-11-20 07:29:48 +08:00
|
|
|
return (
|
2019-03-28 23:58:10 +08:00
|
|
|
<Resizable
|
|
|
|
minWidth={POLL_MIN_WIDTH}
|
|
|
|
maxWidth={POLL_MAX_WIDTH}
|
|
|
|
ref={(node) => { this.resizablePoll = node; }}
|
|
|
|
enable={resizableEnableOptions}
|
|
|
|
key={this.pollKey}
|
|
|
|
size={{ width: pollWidth }}
|
|
|
|
onResizeStop={(e, direction, ref, d) => {
|
2021-04-12 22:51:01 +08:00
|
|
|
this.pollResizeStop(d.width);
|
2019-03-28 23:58:10 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.renderPoll()}
|
|
|
|
</Resizable>
|
2018-11-20 07:29:48 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2018-11-23 11:37:39 +08:00
|
|
|
const { enableResize, openPanel } = this.props;
|
|
|
|
if (openPanel === '') return null;
|
2019-07-18 08:30:28 +08:00
|
|
|
const panels = [];
|
2020-06-20 13:46:10 +08:00
|
|
|
|
2019-07-18 08:30:28 +08:00
|
|
|
if (enableResize) {
|
|
|
|
panels.push(
|
|
|
|
this.renderUserListResizable(),
|
|
|
|
<div className={styles.userlistPad} key={this.padKey} />,
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
panels.push(this.renderUserList());
|
|
|
|
}
|
2018-11-23 11:37:39 +08:00
|
|
|
|
|
|
|
if (openPanel === 'chat') {
|
2018-12-18 23:54:20 +08:00
|
|
|
if (enableResize) {
|
2019-07-18 08:30:28 +08:00
|
|
|
panels.push(this.renderChatResizable());
|
2018-12-18 23:54:20 +08:00
|
|
|
} else {
|
|
|
|
panels.push(this.renderChat());
|
|
|
|
}
|
2018-11-20 07:29:48 +08:00
|
|
|
}
|
2018-11-23 11:37:39 +08:00
|
|
|
|
2018-12-13 04:10:27 +08:00
|
|
|
if (openPanel === 'note') {
|
|
|
|
if (enableResize) {
|
2019-07-18 08:30:28 +08:00
|
|
|
panels.push(this.renderNoteResizable());
|
2018-12-13 04:10:27 +08:00
|
|
|
} else {
|
|
|
|
panels.push(this.renderNote());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-17 04:11:10 +08:00
|
|
|
if (openPanel === 'captions') {
|
|
|
|
if (enableResize) {
|
2019-07-18 08:30:28 +08:00
|
|
|
panels.push(this.renderCaptionsResizable());
|
2019-05-17 04:11:10 +08:00
|
|
|
} else {
|
|
|
|
panels.push(this.renderCaptions());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-23 11:37:39 +08:00
|
|
|
if (openPanel === 'poll') {
|
2018-12-18 23:54:20 +08:00
|
|
|
if (enableResize) {
|
2019-07-18 08:30:28 +08:00
|
|
|
panels.push(this.renderPollResizable());
|
2018-12-18 23:54:20 +08:00
|
|
|
} else {
|
|
|
|
panels.push(this.renderPoll());
|
|
|
|
}
|
2018-11-23 11:37:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (openPanel === 'breakoutroom') {
|
2018-12-18 23:54:20 +08:00
|
|
|
if (enableResize) {
|
2019-07-18 08:30:28 +08:00
|
|
|
panels.push(this.renderBreakoutRoom());
|
2018-12-18 23:54:20 +08:00
|
|
|
} else {
|
|
|
|
panels.push(this.renderBreakoutRoom());
|
|
|
|
}
|
2018-11-23 11:37:39 +08:00
|
|
|
}
|
|
|
|
|
2019-02-27 01:08:15 +08:00
|
|
|
if (openPanel === 'waitingUsersPanel') {
|
|
|
|
if (enableResize) {
|
2019-07-18 08:30:28 +08:00
|
|
|
panels.push(this.renderWaitingUsersPanelResizable());
|
2019-02-27 01:08:15 +08:00
|
|
|
} else {
|
|
|
|
panels.push(this.renderWaitingUsersPanel());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-18 08:30:28 +08:00
|
|
|
return panels;
|
2018-11-20 07:29:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-25 20:52:23 +08:00
|
|
|
export default injectIntl(withLayoutConsumer(PanelManager));
|
2018-12-18 23:15:51 +08:00
|
|
|
|
|
|
|
PanelManager.propTypes = propTypes;
|