2024-02-06 21:12:25 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import deviceInfo from '/imports/utils/deviceInfo';
|
2024-04-05 20:42:32 +08:00
|
|
|
import { useMutation } from '@apollo/client';
|
2024-02-06 21:12:25 +08:00
|
|
|
import LeaveMeetingButton from './component';
|
|
|
|
import { meetingIsBreakout } from '/imports/ui/components/app/service';
|
|
|
|
import { layoutSelectInput, layoutSelect } from '../../layout/context';
|
|
|
|
import { SMALL_VIEWPORT_BREAKPOINT } from '../../layout/enums';
|
2024-04-05 20:42:32 +08:00
|
|
|
import { USER_LEAVE_MEETING } from '/imports/ui/core/graphql/mutations/userMutations';
|
2024-02-06 21:12:25 +08:00
|
|
|
|
|
|
|
const LeaveMeetingButtonContainer = (props) => {
|
|
|
|
const { width: browserWidth } = layoutSelectInput((i) => i.browser);
|
|
|
|
const isMobile = browserWidth <= SMALL_VIEWPORT_BREAKPOINT;
|
|
|
|
const isRTL = layoutSelect((i) => i.isRTL);
|
2024-04-05 20:42:32 +08:00
|
|
|
const [userLeaveMeeting] = useMutation(USER_LEAVE_MEETING);
|
2024-02-06 21:12:25 +08:00
|
|
|
|
|
|
|
return (
|
2024-04-05 20:42:32 +08:00
|
|
|
<LeaveMeetingButton {...
|
|
|
|
{
|
|
|
|
isMobile, isRTL, userLeaveMeeting, ...props,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/>
|
2024-02-06 21:12:25 +08:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default withTracker((props) => ({
|
|
|
|
amIModerator: props.amIModerator,
|
|
|
|
isMobile: deviceInfo.isMobile,
|
|
|
|
isMeteorConnected: Meteor.status().connected,
|
|
|
|
isBreakoutRoom: meetingIsBreakout(),
|
|
|
|
isDropdownOpen: Session.get('dropdownOpen'),
|
|
|
|
}))(LeaveMeetingButtonContainer);
|