2022-02-19 04:45:16 +08:00
|
|
|
import React from 'react';
|
2023-03-10 19:30:46 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2022-02-19 04:45:16 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import PresentationMenu from './component';
|
|
|
|
import FullscreenService from '/imports/ui/components/common/fullscreen-button/service';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import Meetings from '/imports/api/meetings';
|
|
|
|
import { layoutSelect, layoutDispatch } from '/imports/ui/components/layout/context';
|
2023-03-15 12:43:21 +08:00
|
|
|
import WhiteboardService from '/imports/ui/components/whiteboard/service';
|
|
|
|
import UserService from '/imports/ui/components/user-list/service';
|
2023-06-07 20:35:56 +08:00
|
|
|
import { isSnapshotOfCurrentSlideEnabled } from '/imports/ui/services/features';
|
2022-02-19 04:45:16 +08:00
|
|
|
|
|
|
|
const PresentationMenuContainer = (props) => {
|
|
|
|
const fullscreen = layoutSelect((i) => i.fullscreen);
|
|
|
|
const { element: currentElement, group: currentGroup } = fullscreen;
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2022-03-26 00:38:57 +08:00
|
|
|
const { elementId } = props;
|
|
|
|
const isFullscreen = currentElement === elementId;
|
2022-06-17 00:32:27 +08:00
|
|
|
const isRTL = layoutSelect((i) => i.isRTL);
|
2022-02-19 04:45:16 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<PresentationMenu
|
|
|
|
{...props}
|
|
|
|
{...{
|
|
|
|
currentElement,
|
|
|
|
currentGroup,
|
2022-03-26 00:38:57 +08:00
|
|
|
isFullscreen,
|
2022-02-19 04:45:16 +08:00
|
|
|
layoutContextDispatch,
|
2022-06-17 00:32:27 +08:00
|
|
|
isRTL,
|
2022-02-19 04:45:16 +08:00
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default withTracker((props) => {
|
|
|
|
const handleToggleFullscreen = (ref) => FullscreenService.toggleFullScreen(ref);
|
|
|
|
const isIphone = !!(navigator.userAgent.match(/iPhone/i));
|
|
|
|
const meetingId = Auth.meetingID;
|
|
|
|
const meetingObject = Meetings.findOne({ meetingId }, { fields: { 'meetingProp.name': 1 } });
|
2023-03-15 12:43:21 +08:00
|
|
|
const hasWBAccess = WhiteboardService.hasMultiUserAccess(WhiteboardService.getCurrentWhiteboardId(), Auth.userID);
|
|
|
|
const amIPresenter = UserService.isUserPresenter(Auth.userID);
|
2022-02-19 04:45:16 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
...props,
|
2023-06-07 20:35:56 +08:00
|
|
|
allowSnapshotOfCurrentSlide: isSnapshotOfCurrentSlideEnabled(),
|
2022-02-19 04:45:16 +08:00
|
|
|
handleToggleFullscreen,
|
|
|
|
isIphone,
|
|
|
|
isDropdownOpen: Session.get('dropdownOpen'),
|
|
|
|
meetingName: meetingObject.meetingProp.name,
|
2023-03-15 12:43:21 +08:00
|
|
|
hasWBAccess,
|
|
|
|
amIPresenter,
|
2022-02-19 04:45:16 +08:00
|
|
|
};
|
|
|
|
})(PresentationMenuContainer);
|
2023-03-10 19:30:46 +08:00
|
|
|
|
|
|
|
PresentationMenuContainer.propTypes = {
|
|
|
|
elementId: PropTypes.string.isRequired,
|
|
|
|
};
|