bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/annotation-group/container.jsx

46 lines
1.3 KiB
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
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,
}) => (
<AnnotationGroup
2020-04-07 04:34:08 +08:00
annotationsInfo={annotationsInfo}
slideWidth={width}
slideHeight={height}
whiteboardId={whiteboardId}
/>
);
2017-02-23 08:10:30 +08:00
export default withTracker((params) => {
2020-04-07 04:34:08 +08:00
const {
whiteboardId,
published,
} = params;
const fetchFunc = published
? AnnotationGroupService.getCurrentAnnotationsInfo : AnnotationGroupService.getUnsetAnnotations;
const annotationsInfo = fetchFunc(whiteboardId);
2017-02-23 08:10:30 +08:00
return {
annotationsInfo,
2017-02-23 08:10:30 +08:00
};
})(AnnotationGroupContainer);
2017-02-23 08:10:30 +08:00
AnnotationGroupContainer.propTypes = {
2018-04-10 07:18:49 +08:00
whiteboardId: PropTypes.string.isRequired,
// 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
annotationsInfo: PropTypes.arrayOf(PropTypes.shape({
status: PropTypes.string.isRequired,
_id: PropTypes.string.isRequired,
annotationType: PropTypes.string.isRequired,
})).isRequired,
};