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,
|
|
|
|
} from '/imports/ui/components/layout/layout-manager';
|
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-03-28 23:58:10 +08:00
|
|
|
// Variables for resizing poll.
|
|
|
|
const POLL_MIN_WIDTH = 320;
|
|
|
|
const POLL_MAX_WIDTH = 400;
|
|
|
|
|
2019-01-11 23:48:31 +08:00
|
|
|
// Variables for resizing shared notes.
|
2019-03-28 23:58:10 +08:00
|
|
|
const NOTE_MIN_WIDTH = DEFAULT_PANEL_WIDTH;
|
2018-12-13 04:10:27 +08:00
|
|
|
const NOTE_MAX_WIDTH = 800;
|
|
|
|
|
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.
|
2019-04-03 01:52:05 +08:00
|
|
|
const WAITING_MIN_WIDTH = DEFAULT_PANEL_WIDTH;
|
2019-04-02 23:30:35 +08:00
|
|
|
const WAITING_MAX_WIDTH = 800;
|
|
|
|
|
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
|
|
|
chatWidth: chatSize.width,
|
2020-07-16 00:44:59 +08:00
|
|
|
pollWidth: DEFAULT_PANEL_WIDTH,
|
2020-03-25 20:52:23 +08:00
|
|
|
userlistWidth: userListSize.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,
|
2019-04-03 01:52:05 +08:00
|
|
|
waitingWidth: DEFAULT_PANEL_WIDTH,
|
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
|
|
|
shouldComponentUpdate(prevProps) {
|
|
|
|
const { layoutContextState } = this.props;
|
|
|
|
const { layoutContextState: prevLayoutContextState } = prevProps;
|
|
|
|
const { userListSize, chatSize } = layoutContextState;
|
|
|
|
const { userListSize: prevUserListSize, chatSize: prevChatSize } = prevLayoutContextState;
|
|
|
|
|
|
|
|
if ((layoutContextState !== prevLayoutContextState)
|
|
|
|
&& (userListSize.width === prevUserListSize.width
|
|
|
|
&& chatSize.width === prevChatSize.width)) return false;
|
|
|
|
return true;
|
|
|
|
}
|
2020-03-25 20:52:23 +08:00
|
|
|
|
2020-03-25 20:52:23 +08:00
|
|
|
|
|
|
|
componentDidUpdate(prevProps) {
|
|
|
|
const { chatWidth, userlistWidth } = this.state;
|
|
|
|
const { layoutContextState } = this.props;
|
|
|
|
const { userListSize, chatSize } = layoutContextState;
|
|
|
|
const { layoutContextState: oldLayoutContextState } = prevProps;
|
|
|
|
const { userListSize: oldUserListSize, chatSize: oldChatSize } = oldLayoutContextState;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
setUserListWidth(userlistWidth) {
|
|
|
|
this.setState({ userlistWidth });
|
|
|
|
}
|
|
|
|
|
|
|
|
setChatWidth(chatWidth) {
|
|
|
|
this.setState({ chatWidth });
|
|
|
|
}
|
|
|
|
|
|
|
|
userListResizeStop(addvalue) {
|
|
|
|
const { userlistWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
userlistWidth: userlistWidth + addvalue,
|
|
|
|
});
|
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setUserListSize',
|
|
|
|
value: {
|
|
|
|
width: userlistWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
window.dispatchEvent(new Event('userListResizeChanged'));
|
|
|
|
}
|
|
|
|
|
|
|
|
chatResizeStop(addvalue) {
|
|
|
|
const { chatWidth } = this.state;
|
|
|
|
const { layoutContextDispatch } = this.props;
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
chatWidth: chatWidth + addvalue,
|
|
|
|
});
|
|
|
|
|
|
|
|
layoutContextDispatch(
|
|
|
|
{
|
|
|
|
type: 'setChatSize',
|
|
|
|
value: {
|
|
|
|
width: chatWidth + addvalue,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
window.dispatchEvent(new Event('chatResizeChanged'));
|
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
|
|
|
|
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
|
|
|
|
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-07-16 00:44:59 +08:00
|
|
|
this.setState({
|
|
|
|
noteWidth: noteWidth + 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
|
|
|
|
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) => {
|
2020-07-16 00:44:59 +08:00
|
|
|
this.setState({
|
|
|
|
captionsWidth: captionsWidth + 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
|
|
|
|
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) => {
|
2020-07-16 00:44:59 +08:00
|
|
|
this.setState({
|
|
|
|
waitingWidth: waitingWidth + d.width,
|
|
|
|
});
|
2019-02-27 01:08:15 +08:00
|
|
|
}}
|
|
|
|
>
|
|
|
|
{this.renderWaitingUsersPanel()}
|
|
|
|
</Resizable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-03-28 23:58:10 +08:00
|
|
|
renderBreakoutRoom() {
|
|
|
|
return (
|
2020-07-16 00:44:59 +08:00
|
|
|
<div className={styles.breakoutRoom} key={this.breakoutroomKey}>
|
2019-03-28 23:58:10 +08:00
|
|
|
<BreakoutRoomContainer />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2018-11-20 07:29:48 +08:00
|
|
|
renderPoll() {
|
|
|
|
return (
|
2018-11-21 03:18:30 +08:00
|
|
|
<div className={styles.poll} key={this.pollKey}>
|
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) => {
|
2020-07-16 00:44:59 +08:00
|
|
|
window.dispatchEvent(new Event('resize'));
|
|
|
|
this.setState({
|
|
|
|
pollWidth: pollWidth + 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 = [];
|
|
|
|
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;
|