2021-09-10 04:49:15 +08:00
|
|
|
import React from 'react';
|
2019-05-17 04:11:10 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import { Session } from 'meteor/session';
|
|
|
|
import CaptionsService from '/imports/ui/components/captions/service';
|
2019-06-19 04:13:09 +08:00
|
|
|
import Pad from './component';
|
2019-08-30 00:26:07 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutSelectInput, layoutDispatch } from '../../layout/context';
|
2021-05-18 04:25:07 +08:00
|
|
|
import { ACTIONS, PANELS } from '../../layout/enums';
|
2019-05-17 04:11:10 +08:00
|
|
|
|
2021-05-18 04:25:07 +08:00
|
|
|
const PadContainer = (props) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const cameraDock = layoutSelectInput((i) => i.cameraDock);
|
2021-08-19 20:59:50 +08:00
|
|
|
const { isResizing } = cameraDock;
|
2021-09-11 04:48:52 +08:00
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2021-08-19 20:59:50 +08:00
|
|
|
|
2021-05-18 04:25:07 +08:00
|
|
|
const {
|
|
|
|
amIModerator,
|
|
|
|
children,
|
|
|
|
} = props;
|
|
|
|
|
|
|
|
if (!amIModerator) {
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-05-18 04:25:07 +08:00
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.NONE,
|
|
|
|
});
|
|
|
|
return null;
|
2019-05-17 04:11:10 +08:00
|
|
|
}
|
2021-05-18 04:25:07 +08:00
|
|
|
|
|
|
|
return (
|
2021-08-19 20:59:50 +08:00
|
|
|
<Pad {...{ layoutContextDispatch, isResizing, ...props }}>
|
2021-05-18 04:25:07 +08:00
|
|
|
{children}
|
|
|
|
</Pad>
|
|
|
|
);
|
|
|
|
};
|
2019-05-17 04:11:10 +08:00
|
|
|
|
|
|
|
export default withTracker(() => {
|
|
|
|
const locale = Session.get('captionsLocale');
|
|
|
|
const caption = CaptionsService.getCaptions(locale);
|
|
|
|
const {
|
2021-10-05 03:22:18 +08:00
|
|
|
name,
|
2019-05-17 04:11:10 +08:00
|
|
|
ownerId,
|
|
|
|
} = caption;
|
|
|
|
|
|
|
|
return {
|
|
|
|
locale,
|
2019-05-23 22:51:01 +08:00
|
|
|
name,
|
2019-05-17 04:11:10 +08:00
|
|
|
ownerId,
|
2019-08-30 00:26:07 +08:00
|
|
|
currentUserId: Auth.userID,
|
2019-05-22 03:21:46 +08:00
|
|
|
amIModerator: CaptionsService.amIModerator(),
|
2019-05-17 04:11:10 +08:00
|
|
|
};
|
|
|
|
})(PadContainer);
|