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

50 lines
1.7 KiB
React
Raw Normal View History

import React from 'react';
2018-12-13 04:10:27 +08:00
import { withTracker } from 'meteor/react-meteor-data';
import Notes from './component';
import Service from './service';
import { layoutSelectInput, layoutDispatch, layoutSelectOutput } from '../layout/context';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import NotesContainerGraphql from './notes-graphql/component';
import { useSubscription } from '@apollo/client';
import { PINNED_PAD_SUBSCRIPTION } from './notes-graphql/queries';
const NOTES_CONFIG = window.meetingClientSettings.public.notes;
2018-12-13 04:10:27 +08:00
const Container = ({ ...props }) => {
2021-09-11 04:48:52 +08:00
const cameraDock = layoutSelectInput((i) => i.cameraDock);
const sharedNotesOutput = layoutSelectOutput((i) => i.sharedNotes);
const sidebarContent = layoutSelectInput((i) => i.sidebarContent);
2021-08-19 21:05:25 +08:00
const { isResizing } = cameraDock;
2021-09-11 04:48:52 +08:00
const layoutContextDispatch = layoutDispatch();
const { data: currentUserData } = useCurrentUser((user) => ({
presenter: user.presenter,
}));
const amIPresenter = currentUserData?.presenter;
const { data: pinnedPadData } = useSubscription(PINNED_PAD_SUBSCRIPTION);
const shouldShowSharedNotesOnPresentationArea = !!pinnedPadData
&& pinnedPadData.sharedNotes[0]?.sharedNotesExtId === NOTES_CONFIG.id;
return <Notes {...{
layoutContextDispatch,
isResizing,
sidebarContent,
sharedNotesOutput,
amIPresenter,
shouldShowSharedNotesOnPresentationArea,
...props
}} />;
2021-05-18 04:25:07 +08:00
};
2018-12-13 04:10:27 +08:00
withTracker(() => {
const hasPermission = Service.hasPermission();
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
2018-12-13 04:10:27 +08:00
return {
hasPermission,
isRTL,
2024-02-23 21:42:12 +08:00
isGridEnabled: Session.get('isGridEnabled') || false,
2018-12-13 04:10:27 +08:00
};
})(Container);
export default NotesContainerGraphql;