bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/sidebar-content/container.jsx

45 lines
1.5 KiB
React
Raw Normal View History

import React from 'react';
2021-05-18 04:25:07 +08:00
import SidebarContent from './component';
2021-09-11 04:48:52 +08:00
import { layoutSelectInput, layoutSelectOutput, layoutDispatch } from '../layout/context';
2023-10-11 20:10:02 +08:00
import {
CURRENT_PRESENTATION_PAGE_SUBSCRIPTION,
} from '/imports/ui/components/whiteboard/queries';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
import useDeduplicatedSubscription from '../../core/hooks/useDeduplicatedSubscription';
2021-05-18 04:25:07 +08:00
const SidebarContentContainer = () => {
2021-09-11 04:48:52 +08:00
const sidebarContentInput = layoutSelectInput((i) => i.sidebarContent);
const sidebarContentOutput = layoutSelectOutput((i) => i.sidebarContent);
const layoutContextDispatch = layoutDispatch();
const { sidebarContentPanel } = sidebarContentInput;
const { data: currentUserData } = useCurrentUser((user) => ({
presenter: user.presenter,
isModerator: user.isModerator,
}));
const amIPresenter = currentUserData?.presenter;
const amIModerator = currentUserData?.isModerator;
2022-06-22 21:17:59 +08:00
const { data: presentationPageData } = useDeduplicatedSubscription(
CURRENT_PRESENTATION_PAGE_SUBSCRIPTION,
);
2023-10-11 20:10:02 +08:00
const presentationPage = presentationPageData?.pres_page_curr[0] || {};
const currentSlideId = presentationPage?.pageId;
if (sidebarContentOutput.display === false) return null;
2021-05-18 04:25:07 +08:00
return (
<SidebarContent
{...sidebarContentOutput}
2021-09-11 04:48:52 +08:00
contextDispatch={layoutContextDispatch}
2021-05-18 04:25:07 +08:00
sidebarContentPanel={sidebarContentPanel}
2022-06-22 21:17:59 +08:00
amIPresenter={amIPresenter}
amIModerator={amIModerator}
2023-10-11 20:10:02 +08:00
currentSlideId={currentSlideId}
2021-05-18 04:25:07 +08:00
/>
);
};
export default SidebarContentContainer;