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

77 lines
2.8 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';
2024-06-14 21:30:48 +08:00
import { useIsChatEnabled, useIsScreenSharingEnabled } from '/imports/ui/services/features';
import UserReactionService from '/imports/ui/components/user-reaction/service';
import AudioCaptionsService from '/imports/ui/components/audio/audio-graphql/audio-captions/service';
2017-03-29 02:41:48 +08:00
import {
updateSettings,
getAvailableLocales,
2024-07-03 01:58:58 +08:00
FALLBACK_LOCALES,
} from './service';
2024-01-30 21:03:11 +08:00
import useUserChangedLocalSettings from '../../services/settings/hooks/useUserChangedLocalSettings';
2024-06-17 19:54:03 +08:00
import { useShouldRenderPaginationToggle } from '/imports/ui/components/video-provider/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 transcription = useSettings(SETTINGS.TRANSCRIPTION);
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();
const isGladiaEnabled = AudioCaptionsService.isGladia();
2024-06-14 21:30:48 +08:00
const isChatEnabled = useIsChatEnabled();
2021-06-19 02:32:46 +08:00
2024-01-30 21:03:11 +08:00
return (
<Settings
{...{
...props,
updateSettings,
application,
audio,
dataSaving,
transcription,
availableLocales,
isPresenter,
isModerator,
isScreenSharingEnabled,
showGuestNotification,
isReactionsEnabled,
showToggleLabel: false,
isVideoEnabled: window.meetingClientSettings.public.kurento.enableVideo,
isGladiaEnabled,
2024-06-14 21:30:48 +08:00
isChatEnabled,
}}
2024-01-30 21:03:11 +08:00
layoutContextDispatch={layoutContextDispatch}
setLocalSettings={setLocalSettings}
paginationToggleEnabled={paginationToggleEnabled}
2024-07-03 01:58:58 +08:00
fallbackLocales={FALLBACK_LOCALES}
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;