2023-11-30 19:08:16 +08:00
|
|
|
import React from 'react';
|
2019-05-17 04:11:10 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2021-10-16 03:07:13 +08:00
|
|
|
import Service from '/imports/ui/components/captions/service';
|
2019-05-17 04:11:10 +08:00
|
|
|
import WriterMenu from './component';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutDispatch } from '../../layout/context';
|
2023-11-30 19:08:16 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
2021-09-02 03:54:09 +08:00
|
|
|
|
2021-05-18 04:25:07 +08:00
|
|
|
const WriterMenuContainer = (props) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2021-09-10 21:16:44 +08:00
|
|
|
|
2023-11-30 19:08:16 +08:00
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
2023-11-30 21:24:25 +08:00
|
|
|
isModerator: user.isModerator,
|
2023-11-30 19:08:16 +08:00
|
|
|
}));
|
2023-11-30 21:24:25 +08:00
|
|
|
const amIModerator = currentUserData?.isModerator;
|
2021-09-02 03:54:09 +08:00
|
|
|
|
2023-02-15 01:41:45 +08:00
|
|
|
return amIModerator && <WriterMenu {...{ layoutContextDispatch, ...props }} />;
|
2021-05-18 04:25:07 +08:00
|
|
|
};
|
2019-05-17 04:11:10 +08:00
|
|
|
|
2023-06-22 06:59:17 +08:00
|
|
|
export default withTracker(({ setIsOpen }) => ({
|
|
|
|
closeModal: () => setIsOpen(false),
|
2023-02-15 01:41:45 +08:00
|
|
|
availableLocales: Service.getAvailableLocales(),
|
2023-06-22 06:59:17 +08:00
|
|
|
}))(WriterMenuContainer);
|