bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/whiteboard-overlay/container.jsx
Oleksandr Zhurbenko f80d0bc083 Linting and moved whiteboard resize events into HoC
Thus we won't clutter the code with unrelated events and can easily switch to a ResizeObserver when it is implemented by the browsers
2017-09-25 16:45:44 -07:00

45 lines
1.4 KiB
JavaScript

import React from 'react';
import { createContainer } from 'meteor/react-meteor-data';
import PropTypes from 'prop-types';
import WhiteboardOverlayService from './service';
import WhiteboardOverlay from './component';
const WhiteboardOverlayContainer = (props) => {
if (Object.keys(props.drawSettings).length > 0) {
return (
<WhiteboardOverlay {...props} />
);
}
return null;
};
export default createContainer(() => ({
sendAnnotation: WhiteboardOverlayService.sendAnnotation,
setTextShapeActiveId: WhiteboardOverlayService.setTextShapeActiveId,
resetTextShapeSession: WhiteboardOverlayService.resetTextShapeSession,
drawSettings: WhiteboardOverlayService.getWhiteboardToolbarValues(),
userId: WhiteboardOverlayService.getCurrentUserId(),
}), WhiteboardOverlayContainer);
WhiteboardOverlayContainer.propTypes = {
drawSettings: PropTypes.shape({
// Annotation color
color: PropTypes.number.isRequired,
// Annotation thickness (not normalized)
thickness: PropTypes.number.isRequired,
// The name of the tool currently selected
tool: PropTypes.string.isRequired,
// Font size for the text shape
textFontSize: PropTypes.number.isRequired,
// Current active text shape value
textShapeValue: PropTypes.string.isRequired,
// Text active text shape id
textShapeActiveId: PropTypes.string.isRequired,
}),
};
WhiteboardOverlayContainer.defaultProps = {
drawSettings: {},
};