move cloe function to container

This commit is contained in:
Bohdan Zhemelinskyi 2023-03-15 18:06:59 +00:00
parent dc9ac7a125
commit 1025e4b1dc
3 changed files with 8 additions and 7 deletions

View File

@ -1,6 +1,5 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { makeCall } from '/imports/ui/services/api';
import { defineMessages, injectIntl } from 'react-intl';
import deviceInfo from '/imports/utils/deviceInfo';
import injectWbResizeEvent from '/imports/ui/components/presentation/resize-wrapper/component';
@ -14,7 +13,6 @@ import ZoomTool from './zoom-tool/component';
import SmartMediaShareContainer from './smart-video-share/container';
import TooltipContainer from '/imports/ui/components/common/tooltip/container';
import KEY_CODES from '/imports/utils/keyCodes';
import { currentPoll } from './service';
const intlMessages = defineMessages({
previousSlideLabel: {
@ -167,7 +165,7 @@ class PresentationToolbar extends PureComponent {
} = this.props;
if (event) event.currentTarget.blur();
if (currentPoll()) makeCall('stopPoll');
this.props.endCurrentPoll();
nextSlide(currentSlideNum, numberOfSlides, podId);
}
@ -175,7 +173,7 @@ class PresentationToolbar extends PureComponent {
const { previousSlide, currentSlideNum, podId } = this.props;
if (event) event.currentTarget.blur();
if (currentPoll()) makeCall('stopPoll');
this.props.endCurrentPoll();
previousSlide(currentSlideNum, podId);
}

View File

@ -10,6 +10,7 @@ import { UsersContext } from '/imports/ui/components/components-data/users-conte
import Auth from '/imports/ui/services/auth';
import FullscreenService from '/imports/ui/components/common/fullscreen-button/service';
import { isPollingEnabled } from '/imports/ui/services/features';
import { CurrentPoll } from '/imports/api/polls';
const PresentationToolbarContainer = (props) => {
const usingUsersContext = useContext(UsersContext);
@ -21,6 +22,10 @@ const PresentationToolbarContainer = (props) => {
const handleToggleFullScreen = (ref) => FullscreenService.toggleFullScreen(ref);
const endCurrentPoll = () => {
if (CurrentPoll.findOne({ meetingId: Auth.meetingID })) makeCall('stopPoll');
}
if (userIsPresenter && !layoutSwapped) {
// Only show controls if user is presenter and layout isn't swapped
@ -28,6 +33,7 @@ const PresentationToolbarContainer = (props) => {
<PresentationToolbar
{...props}
amIPresenter={userIsPresenter}
endCurrentPoll={endCurrentPoll}
{...{
handleToggleFullScreen,
}}

View File

@ -2,12 +2,9 @@ import Auth from '/imports/ui/services/auth';
import Presentations from '/imports/api/presentations';
import { makeCall } from '/imports/ui/services/api';
import { throttle } from 'lodash';
import { CurrentPoll } from '/imports/api/polls';
const PAN_ZOOM_INTERVAL = Meteor.settings.public.presentation.panZoomInterval || 200;
export const currentPoll = () => CurrentPoll.findOne({ meetingId: Auth.meetingID });
const getNumberOfSlides = (podId, presentationId) => {
const meetingId = Auth.meetingID;