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

View File

@ -1,24 +1,22 @@
import React, { Component } from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { createContainer } from 'meteor/react-meteor-data'; import { createContainer } from 'meteor/react-meteor-data';
import PresentationAreaService from './service'; import PresentationAreaService from './service';
import PresentationArea from './component'; import PresentationArea from './component';
class PresentationAreaContainer extends Component { const PresentationAreaContainer = ({ children, ...rest }) => (
constructor(props) { <PresentationArea {...rest}>
super(props); {children}
} </PresentationArea>
);
render() {
return (
<PresentationArea {...this.props}>
{this.props.children}
</PresentationArea>
);
}
}
export default createContainer(() => ({ export default createContainer(() => ({
currentSlide: PresentationAreaService.getCurrentSlide(), currentSlide: PresentationAreaService.getCurrentSlide(),
userIsPresenter: PresentationAreaService.isPresenter(), userIsPresenter: PresentationAreaService.isPresenter(),
multiUser: PresentationAreaService.getMultiUserStatus(),
}), PresentationAreaContainer); }), 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 Presentations from '/imports/api/2.0/presentations';
import Slides from '/imports/api/2.0/slides'; 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 Users from '/imports/api/2.0/users';
import Auth from '/imports/ui/services/auth'; import Auth from '/imports/ui/services/auth';
@ -31,8 +31,19 @@ const isPresenter = () => {
return false; return false;
}; };
const getMultiUserStatus = () => {
const data = WhiteboardMultiUser.findOne({ meetingId: Auth.meetingID });
if (data) {
return data.multiUser;
}
return false;
};
export default { export default {
getCurrentPresentation, getCurrentPresentation,
getCurrentSlide, getCurrentSlide,
isPresenter, isPresenter,
getMultiUserStatus,
}; };