bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/settings/container.jsx

68 lines
2.4 KiB
React
Raw Normal View History

import React from 'react';
import Settings from './component';
2021-09-11 04:48:52 +08:00
import { layoutDispatch } from '../layout/context';
import { useIsScreenSharingEnabled } from '/imports/ui/services/features';
import UserReactionService from '/imports/ui/components/user-reaction/service';
2017-03-29 02:41:48 +08:00
import {
updateSettings,
getAvailableLocales,
} from './service';
2024-01-30 21:03:11 +08:00
import useUserChangedLocalSettings from '../../services/settings/hooks/useUserChangedLocalSettings';
import { useShouldRenderPaginationToggle } from '/imports/ui/components/video-provider/video-provider-graphql/hooks';
import useSettings from '/imports/ui/services/settings/hooks/useSettings';
import { SETTINGS } from '/imports/ui/services/settings/enums';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import useMeeting from '/imports/ui/core/hooks/useMeeting';
const ASK_MODERATOR = 'ASK_MODERATOR';
2021-08-09 22:24:02 +08:00
const SettingsContainer = (props) => {
2021-09-11 04:48:52 +08:00
const layoutContextDispatch = layoutDispatch();
2024-01-30 21:03:11 +08:00
const setLocalSettings = useUserChangedLocalSettings();
const paginationToggleEnabled = useShouldRenderPaginationToggle();
const { data: currentUser } = useCurrentUser((u) => ({
presenter: u.presenter,
isModerator: u.isModerator,
}));
const { data: meeting } = useMeeting((m) => ({
usersPolicies: {
guestPolicy: m.usersPolicies.guestPolicy,
},
}));
const application = useSettings(SETTINGS.APPLICATION);
const audio = useSettings(SETTINGS.AUDIO);
const dataSaving = useSettings(SETTINGS.DATA_SAVING);
const availableLocales = getAvailableLocales();
const isPresenter = currentUser?.presenter ?? false;
const isModerator = currentUser?.isModerator ?? false;
const isScreenSharingEnabled = useIsScreenSharingEnabled();
const showGuestNotification = meeting?.usersPolicies?.guestPolicy === ASK_MODERATOR;
const isReactionsEnabled = UserReactionService.useIsEnabled();
2021-06-19 02:32:46 +08:00
2024-01-30 21:03:11 +08:00
return (
<Settings
{...{
...props,
updateSettings,
application,
audio,
dataSaving,
availableLocales,
isPresenter,
isModerator,
isScreenSharingEnabled,
showGuestNotification,
isReactionsEnabled,
showToggleLabel: false,
isVideoEnabled: window.meetingClientSettings.public.kurento.enableVideo,
}}
2024-01-30 21:03:11 +08:00
layoutContextDispatch={layoutContextDispatch}
setLocalSettings={setLocalSettings}
paginationToggleEnabled={paginationToggleEnabled}
2024-01-30 21:03:11 +08:00
/>
);
2021-06-19 02:32:46 +08:00
};
2016-12-23 09:48:19 +08:00
export default SettingsContainer;