2017-08-26 06:45:06 +08:00
|
|
|
import React from 'react';
|
2017-06-04 10:40:14 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } 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
|
|
|
|
2020-04-07 04:34:08 +08:00
|
|
|
const AnnotationGroupContainer = ({
|
|
|
|
annotationsInfo, width, height, whiteboardId,
|
|
|
|
}) => (
|
2017-08-26 06:45:06 +08:00
|
|
|
<AnnotationGroup
|
2020-04-07 04:34:08 +08:00
|
|
|
annotationsInfo={annotationsInfo}
|
|
|
|
slideWidth={width}
|
|
|
|
slideHeight={height}
|
|
|
|
whiteboardId={whiteboardId}
|
2017-08-26 06:45:06 +08:00
|
|
|
/>
|
|
|
|
);
|
2017-02-23 08:10:30 +08:00
|
|
|
|
2018-01-08 12:44:42 +08:00
|
|
|
export default withTracker((params) => {
|
2020-04-07 04:34:08 +08:00
|
|
|
const {
|
|
|
|
whiteboardId,
|
|
|
|
published,
|
|
|
|
} = params;
|
|
|
|
|
|
|
|
const fetchFunc = published
|
2021-12-02 22:37:31 +08:00
|
|
|
? AnnotationGroupService.getCurrentAnnotationsInfo : AnnotationGroupService.getUnsentAnnotations;
|
2020-04-07 04:34:08 +08:00
|
|
|
|
|
|
|
const annotationsInfo = fetchFunc(whiteboardId);
|
2017-02-23 08:10:30 +08:00
|
|
|
return {
|
2017-08-26 06:45:06 +08:00
|
|
|
annotationsInfo,
|
2017-02-23 08:10:30 +08:00
|
|
|
};
|
2018-01-08 12:44:42 +08:00
|
|
|
})(AnnotationGroupContainer);
|
2017-02-23 08:10:30 +08:00
|
|
|
|
2017-08-20 14:32:01 +08:00
|
|
|
AnnotationGroupContainer.propTypes = {
|
2018-04-10 07:18:49 +08:00
|
|
|
whiteboardId: PropTypes.string.isRequired,
|
2017-08-20 14:32:01 +08:00
|
|
|
// initial width and height of the slide; required to calculate the annotations' coordinates
|
|
|
|
width: PropTypes.number.isRequired,
|
|
|
|
height: PropTypes.number.isRequired,
|
|
|
|
|
|
|
|
// array of annotations, optional
|
2017-08-26 06:45:06 +08:00
|
|
|
annotationsInfo: PropTypes.arrayOf(PropTypes.shape({
|
|
|
|
status: PropTypes.string.isRequired,
|
|
|
|
_id: PropTypes.string.isRequired,
|
|
|
|
annotationType: PropTypes.string.isRequired,
|
|
|
|
})).isRequired,
|
2017-08-20 14:32:01 +08:00
|
|
|
};
|