2023-11-30 19:08:16 +08:00
|
|
|
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 { useSubscription } from '@apollo/client';
|
|
|
|
import {
|
|
|
|
CURRENT_PRESENTATION_PAGE_SUBSCRIPTION,
|
|
|
|
} from '/imports/ui/components/whiteboard/queries';
|
2023-11-30 19:08:16 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
2021-05-18 04:25:07 +08:00
|
|
|
|
2021-09-10 03:16:26 +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();
|
2021-05-19 22:51:31 +08:00
|
|
|
const { sidebarContentPanel } = sidebarContentInput;
|
2023-11-30 19:08:16 +08:00
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
|
|
|
presenter: user.presenter,
|
2023-11-30 21:24:25 +08:00
|
|
|
isModerator: user.isModerator,
|
2023-11-30 19:08:16 +08:00
|
|
|
}));
|
|
|
|
const amIPresenter = currentUserData?.presenter;
|
2023-11-30 21:24:25 +08:00
|
|
|
const amIModerator = currentUserData?.isModerator;
|
2022-06-22 21:17:59 +08:00
|
|
|
|
2023-10-11 20:10:02 +08:00
|
|
|
const { data: presentationPageData } = useSubscription(CURRENT_PRESENTATION_PAGE_SUBSCRIPTION);
|
|
|
|
const presentationPage = presentationPageData?.pres_page_curr[0] || {};
|
|
|
|
|
|
|
|
const currentSlideId = presentationPage?.pageId;
|
|
|
|
|
2021-05-18 04:25:07 +08:00
|
|
|
return (
|
|
|
|
<SidebarContent
|
2021-09-10 03:16:26 +08:00
|
|
|
{...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}
|
2023-11-30 21:24:25 +08:00
|
|
|
amIModerator={amIModerator}
|
2023-10-11 20:10:02 +08:00
|
|
|
currentSlideId={currentSlideId}
|
2021-05-18 04:25:07 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2021-09-10 03:16:26 +08:00
|
|
|
export default SidebarContentContainer;
|