bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/lock-viewers/container.jsx

62 lines
2.0 KiB
React
Raw Normal View History

import React from 'react';
2024-01-11 21:57:51 +08:00
import { useMutation } from '@apollo/client';
import LockViewersComponent from './component';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import { SET_LOCK_SETTINGS_PROPS, SET_WEBCAM_ONLY_FOR_MODERATOR } from './mutations';
import useMeeting from '../../core/hooks/useMeeting';
const LockViewersContainer = (props) => {
const { data: currentUserData } = useCurrentUser((user) => ({
isModerator: user.isModerator,
}));
const amIModerator = currentUserData?.isModerator;
2024-01-11 21:57:51 +08:00
const [setLockSettingsProps] = useMutation(SET_LOCK_SETTINGS_PROPS);
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,
},
});
};
const updateWebcamsOnlyForModerator = (webcamsOnlyForModerator) => {
setWebcamOnlyForModerator({
variables: {
webcamsOnlyForModerator,
},
});
};
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 && (
<LockViewersComponent
updateWebcamsOnlyForModerator={updateWebcamsOnlyForModerator}
updateLockSettings={updateLockSettings}
closeModal={closeModal}
showToggleLabel={false}
meeting={meeting}
{...props}
/>
);
};
export default LockViewersContainer;