2024-04-20 04:34:43 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { useMutation } from '@apollo/client';
|
|
|
|
import ManyUsersComponent from './component';
|
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
|
|
|
import { SET_WEBCAM_ONLY_FOR_MODERATOR } from '/imports/ui/components/lock-viewers/mutations';
|
|
|
|
import { useViewersInWebcamCount } from '../hooks';
|
2024-06-12 21:16:18 +08:00
|
|
|
import useMeeting from '/imports/ui/core/hooks/useMeeting';
|
2024-04-20 04:34:43 +08:00
|
|
|
|
2024-06-12 21:16:18 +08:00
|
|
|
const ManyUsersContainer: React.FC = () => {
|
2024-04-20 04:34:43 +08:00
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
|
|
|
isModerator: user.isModerator,
|
|
|
|
}));
|
2024-06-12 21:16:18 +08:00
|
|
|
const { data: meetingData } = useMeeting((m) => ({
|
|
|
|
usersPolicies: m.usersPolicies,
|
|
|
|
lockSettings: m.lockSettings,
|
|
|
|
}));
|
2024-04-20 04:34:43 +08:00
|
|
|
|
|
|
|
const [setWebcamOnlyForModerator] = useMutation(SET_WEBCAM_ONLY_FOR_MODERATOR);
|
|
|
|
|
|
|
|
const toggleWebcamsOnlyForModerator = () => {
|
|
|
|
setWebcamOnlyForModerator({
|
|
|
|
variables: {
|
|
|
|
webcamsOnlyForModerator: true,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
const viewersInWebcam = useViewersInWebcamCount();
|
|
|
|
|
2024-05-02 03:48:12 +08:00
|
|
|
const currentUserIsModerator = !!currentUserData?.isModerator;
|
|
|
|
|
2024-06-12 21:16:18 +08:00
|
|
|
const webcamOnlyForModerator = !!meetingData?.usersPolicies?.webcamsOnlyForModerator;
|
|
|
|
const lockSettingsDisableCam = !!meetingData?.lockSettings?.disableCam;
|
2024-05-02 03:48:12 +08:00
|
|
|
|
2024-04-20 04:34:43 +08:00
|
|
|
return (
|
|
|
|
<ManyUsersComponent
|
2024-05-02 03:48:12 +08:00
|
|
|
toggleWebcamsOnlyForModerator={toggleWebcamsOnlyForModerator}
|
|
|
|
currentUserIsModerator={currentUserIsModerator}
|
|
|
|
viewersInWebcam={viewersInWebcam}
|
2024-06-12 21:16:18 +08:00
|
|
|
limitOfViewersInWebcam={window.meetingClientSettings.public.app.viewersInWebcam}
|
|
|
|
limitOfViewersInWebcamIsEnable={window.meetingClientSettings.public.app.enableLimitOfViewersInWebcam}
|
|
|
|
lockSettingsDisableCam={lockSettingsDisableCam}
|
2024-05-02 03:48:12 +08:00
|
|
|
webcamOnlyForModerator={webcamOnlyForModerator}
|
2024-04-20 04:34:43 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-06-12 21:16:18 +08:00
|
|
|
export default ManyUsersContainer;
|