2021-11-23 20:50:26 +08:00
|
|
|
import React, { useContext } from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2017-08-20 14:32:01 +08:00
|
|
|
import TextShapeService from './service';
|
2017-06-17 10:32:41 +08:00
|
|
|
import TextDrawComponent from './component';
|
2021-03-05 06:26:25 +08:00
|
|
|
import WhiteboardService from '/imports/ui/components/whiteboard/service';
|
2021-11-23 20:50:26 +08:00
|
|
|
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
2017-06-17 10:32:41 +08:00
|
|
|
|
2021-11-23 20:50:26 +08:00
|
|
|
const TextDrawContainer = (props) => {
|
|
|
|
const { isMultiUser, activeTextShapeId, annotation } = props;
|
|
|
|
|
|
|
|
const usingUsersContext = useContext(UsersContext);
|
|
|
|
const { users } = usingUsersContext;
|
|
|
|
const currentUser = users[Auth.meetingID][Auth.userID];
|
|
|
|
const userIsPresenter = currentUser.presenter;
|
|
|
|
|
|
|
|
let isActive = false;
|
|
|
|
|
|
|
|
if ((userIsPresenter || isMultiUser) && activeTextShapeId === annotation.id) {
|
|
|
|
isActive = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <TextDrawComponent isActive={isActive} {...props} />;
|
|
|
|
};
|
2017-06-17 10:32:41 +08:00
|
|
|
|
2018-01-08 12:44:42 +08:00
|
|
|
export default withTracker((params) => {
|
2018-04-10 07:18:49 +08:00
|
|
|
const { whiteboardId } = params;
|
2021-03-05 06:26:25 +08:00
|
|
|
const isMultiUser = WhiteboardService.isMultiUserActive(whiteboardId);
|
2017-06-17 10:32:41 +08:00
|
|
|
const activeTextShapeId = TextShapeService.activeTextShapeId();
|
|
|
|
|
|
|
|
return {
|
|
|
|
setTextShapeValue: TextShapeService.setTextShapeValue,
|
2017-08-24 11:35:34 +08:00
|
|
|
resetTextShapeActiveId: TextShapeService.resetTextShapeActiveId,
|
2021-11-23 20:50:26 +08:00
|
|
|
isMultiUser,
|
|
|
|
activeTextShapeId,
|
2017-08-20 14:32:01 +08:00
|
|
|
};
|
2018-01-08 12:44:42 +08:00
|
|
|
})(TextDrawContainer);
|