Made whiteboard-toolbar display when multi-user mode is on

This commit is contained in:
Oleksandr Zhurbenko 2017-08-08 13:55:38 -07:00
parent 227f9d540f
commit f90a1d446f
3 changed files with 26 additions and 17 deletions

View File

@ -215,7 +215,7 @@ export default class PresentationArea extends React.Component {
slideHeight={svgHeight}
/>
</g>
{this.props.userIsPresenter ?
{this.props.userIsPresenter || this.props.multiUser ?
<PresentationOverlayContainer
slideWidth={svgWidth}
slideHeight={svgHeight}
@ -277,7 +277,7 @@ export default class PresentationArea extends React.Component {
{this.state.showSlide ?
this.renderPresentationArea()
: null }
{this.props.userIsPresenter ?
{this.props.userIsPresenter || this.props.multiUser ?
this.renderWhiteboardToolbar()
: null }
</div>

View File

@ -1,24 +1,22 @@
import React, { Component } from 'react';
import React from 'react';
import PropTypes from 'prop-types';
import { createContainer } from 'meteor/react-meteor-data';
import PresentationAreaService from './service';
import PresentationArea from './component';
class PresentationAreaContainer extends Component {
constructor(props) {
super(props);
}
render() {
return (
<PresentationArea {...this.props}>
{this.props.children}
</PresentationArea>
);
}
}
const PresentationAreaContainer = ({ children, ...rest }) => (
<PresentationArea {...rest}>
{children}
</PresentationArea>
);
export default createContainer(() => ({
currentSlide: PresentationAreaService.getCurrentSlide(),
userIsPresenter: PresentationAreaService.isPresenter(),
multiUser: PresentationAreaService.getMultiUserStatus(),
}), PresentationAreaContainer);
PresentationAreaContainer.propTypes = {
children: PropTypes.element,
};

View File

@ -1,6 +1,6 @@
import WhiteboardMultiUser from '/imports/api/2.0/whiteboard-multi-user/';
import Presentations from '/imports/api/2.0/presentations';
import Slides from '/imports/api/2.0/slides';
import Cursor from '/imports/api/2.0/cursor';
import Users from '/imports/api/2.0/users';
import Auth from '/imports/ui/services/auth';
@ -31,8 +31,19 @@ const isPresenter = () => {
return false;
};
const getMultiUserStatus = () => {
const data = WhiteboardMultiUser.findOne({ meetingId: Auth.meetingID });
if (data) {
return data.multiUser;
}
return false;
};
export default {
getCurrentPresentation,
getCurrentSlide,
isPresenter,
getMultiUserStatus,
};