bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/captions/pad/container.jsx

55 lines
1.3 KiB
React
Raw Normal View History

import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import { Session } from 'meteor/session';
import CaptionsService from '/imports/ui/components/captions/service';
import Pad from './component';
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';
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;
}
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>
);
};
export default withTracker(() => {
const locale = Session.get('captionsLocale');
const caption = CaptionsService.getCaptions(locale);
const {
name,
ownerId,
} = caption;
return {
locale,
2019-05-23 22:51:01 +08:00
name,
ownerId,
currentUserId: Auth.userID,
amIModerator: CaptionsService.amIModerator(),
};
})(PadContainer);