2017-06-04 10:40:14 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2017-02-23 08:10:30 +08:00
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
import AnnotationGroupService from './service';
|
|
|
|
import AnnotationGroup from './component';
|
2017-02-23 08:10:30 +08:00
|
|
|
|
|
|
|
const propTypes = {
|
2017-07-27 20:35:55 +08:00
|
|
|
// the id is required to fetch the annotations
|
2017-02-23 08:10:30 +08:00
|
|
|
whiteboardId: PropTypes.string.isRequired,
|
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
// initial width and height of the slide are required to calculate the coordinates for each annotation
|
2017-02-23 08:10:30 +08:00
|
|
|
width: PropTypes.number.isRequired,
|
|
|
|
height: PropTypes.number.isRequired,
|
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
// array of annotations, optional
|
|
|
|
annotations: PropTypes.array,
|
2017-02-23 08:10:30 +08:00
|
|
|
};
|
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
class AnnotationGroupContainer extends React.Component {
|
2017-02-23 08:10:30 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2017-07-27 20:35:55 +08:00
|
|
|
<AnnotationGroup
|
|
|
|
annotations={this.props.annotations}
|
2017-02-23 08:10:30 +08:00
|
|
|
width={this.props.width}
|
|
|
|
height={this.props.height}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default createContainer((params) => {
|
|
|
|
const { whiteboardId, width, height } = params;
|
2017-07-27 20:35:55 +08:00
|
|
|
const annotations = AnnotationGroupService.getCurrentAnnotations(whiteboardId);
|
2017-02-23 08:10:30 +08:00
|
|
|
|
|
|
|
return {
|
2017-07-27 20:35:55 +08:00
|
|
|
annotations,
|
2017-02-23 08:10:30 +08:00
|
|
|
width,
|
|
|
|
height,
|
|
|
|
};
|
2017-07-27 20:35:55 +08:00
|
|
|
}, AnnotationGroupContainer);
|
2017-02-23 08:10:30 +08:00
|
|
|
|
2017-07-27 20:35:55 +08:00
|
|
|
AnnotationGroupContainer.propTypes = propTypes;
|