2023-11-30 19:08:16 +08:00
|
|
|
import React from 'react';
|
2022-10-31 22:05:09 +08:00
|
|
|
import NotesDropdown from './component';
|
|
|
|
import { layoutSelect } from '/imports/ui/components/layout/context';
|
2024-01-23 20:51:14 +08:00
|
|
|
import { useSubscription, useMutation } from '@apollo/client';
|
2023-10-20 20:38:04 +08:00
|
|
|
import {
|
|
|
|
PROCESSED_PRESENTATIONS_SUBSCRIPTION,
|
|
|
|
} from '/imports/ui/components/whiteboard/queries';
|
2023-11-30 19:08:16 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
2024-01-23 20:51:14 +08:00
|
|
|
import { PRESENTATION_SET_CURRENT } from '../../presentation/mutations';
|
2022-10-31 22:05:09 +08:00
|
|
|
|
|
|
|
const NotesDropdownContainer = ({ ...props }) => {
|
2023-11-30 19:08:16 +08:00
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
|
|
|
presenter: user.presenter,
|
|
|
|
}));
|
|
|
|
const amIPresenter = currentUserData?.presenter;
|
2022-10-31 22:05:09 +08:00
|
|
|
const isRTL = layoutSelect((i) => i.isRTL);
|
|
|
|
|
2023-10-20 20:38:04 +08:00
|
|
|
const { data: presentationData } = useSubscription(PROCESSED_PRESENTATIONS_SUBSCRIPTION);
|
|
|
|
const presentations = presentationData?.pres_presentation || [];
|
|
|
|
|
2024-01-23 20:51:14 +08:00
|
|
|
const [presentationSetCurrent] = useMutation(PRESENTATION_SET_CURRENT);
|
|
|
|
|
|
|
|
const setPresentation = (presentationId) => {
|
|
|
|
presentationSetCurrent({ variables: { presentationId } });
|
|
|
|
};
|
|
|
|
|
|
|
|
return <NotesDropdown {...{ amIPresenter, isRTL, presentations, setPresentation, ...props }} />;
|
2022-10-31 22:05:09 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export default NotesDropdownContainer;
|