bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/whiteboard/annotations/text/container.jsx

38 lines
1.3 KiB
React
Raw Normal View History

import React, { useContext } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import TextShapeService from './service';
import TextDrawComponent from './component';
import WhiteboardService from '/imports/ui/components/whiteboard/service';
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
import Auth from '/imports/ui/services/auth';
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} />;
};
export default withTracker((params) => {
2018-04-10 07:18:49 +08:00
const { whiteboardId } = params;
const isMultiUser = WhiteboardService.isMultiUserActive(whiteboardId);
const activeTextShapeId = TextShapeService.activeTextShapeId();
return {
setTextShapeValue: TextShapeService.setTextShapeValue,
resetTextShapeActiveId: TextShapeService.resetTextShapeActiveId,
isMultiUser,
activeTextShapeId,
};
})(TextDrawContainer);