2023-11-30 19:08:16 +08:00
|
|
|
import React from 'react';
|
2024-01-11 21:57:51 +08:00
|
|
|
import { useMutation } from '@apollo/client';
|
2018-11-09 02:55:12 +08:00
|
|
|
import LockViewersComponent from './component';
|
2023-11-30 19:08:16 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
2024-01-12 00:32:32 +08:00
|
|
|
import { SET_LOCK_SETTINGS_PROPS, SET_WEBCAM_ONLY_FOR_MODERATOR } from './mutations';
|
2024-05-16 22:04:26 +08:00
|
|
|
import useMeeting from '../../core/hooks/useMeeting';
|
2018-11-09 02:55:12 +08:00
|
|
|
|
2021-09-02 03:38:33 +08:00
|
|
|
const LockViewersContainer = (props) => {
|
2023-11-30 19:08:16 +08:00
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
2023-11-30 21:24:25 +08:00
|
|
|
isModerator: user.isModerator,
|
2023-11-30 19:08:16 +08:00
|
|
|
}));
|
2023-11-30 21:24:25 +08:00
|
|
|
const amIModerator = currentUserData?.isModerator;
|
2021-09-02 03:38:33 +08:00
|
|
|
|
2024-01-11 21:57:51 +08:00
|
|
|
const [setLockSettingsProps] = useMutation(SET_LOCK_SETTINGS_PROPS);
|
2024-01-12 00:32:32 +08:00
|
|
|
const [setWebcamOnlyForModerator] = useMutation(SET_WEBCAM_ONLY_FOR_MODERATOR);
|
2024-01-11 21:57:51 +08:00
|
|
|
|
|
|
|
const updateLockSettings = (lockSettings) => {
|
|
|
|
setLockSettingsProps({
|
|
|
|
variables: {
|
|
|
|
disableCam: lockSettings.disableCam,
|
|
|
|
disableMic: lockSettings.disableMic,
|
|
|
|
disablePrivChat: lockSettings.disablePrivateChat,
|
|
|
|
disablePubChat: lockSettings.disablePublicChat,
|
|
|
|
disableNotes: lockSettings.disableNotes,
|
|
|
|
hideUserList: lockSettings.hideUserList,
|
|
|
|
lockOnJoin: lockSettings.lockOnJoin,
|
|
|
|
lockOnJoinConfigurable: lockSettings.lockOnJoinConfigurable,
|
|
|
|
hideViewersCursor: lockSettings.hideViewersCursor,
|
|
|
|
hideViewersAnnotation: lockSettings.hideViewersAnnotation,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2024-01-12 00:32:32 +08:00
|
|
|
const updateWebcamsOnlyForModerator = (webcamsOnlyForModerator) => {
|
|
|
|
setWebcamOnlyForModerator({
|
|
|
|
variables: {
|
|
|
|
webcamsOnlyForModerator,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2024-05-16 22:04:26 +08:00
|
|
|
const { setIsOpen } = props;
|
|
|
|
const closeModal = () => setIsOpen(false);
|
|
|
|
const { data: meeting } = useMeeting((m) => ({
|
|
|
|
lockSettings: m.lockSettings,
|
|
|
|
usersPolicies: m.usersPolicies,
|
|
|
|
}));
|
|
|
|
|
2024-05-20 19:56:15 +08:00
|
|
|
return amIModerator && meeting && (
|
2024-01-12 00:32:32 +08:00
|
|
|
<LockViewersComponent
|
|
|
|
updateWebcamsOnlyForModerator={updateWebcamsOnlyForModerator}
|
|
|
|
updateLockSettings={updateLockSettings}
|
2024-05-16 22:04:26 +08:00
|
|
|
closeModal={closeModal}
|
|
|
|
showToggleLabel={false}
|
|
|
|
meeting={meeting}
|
2024-01-12 00:32:32 +08:00
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
2023-11-30 19:08:16 +08:00
|
|
|
};
|
2018-11-09 02:55:12 +08:00
|
|
|
|
2024-05-16 22:04:26 +08:00
|
|
|
export default LockViewersContainer;
|