2019-05-17 04:11:10 +08:00
|
|
|
import React from 'react';
|
|
|
|
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 Captions from './component';
|
2021-10-16 03:07:13 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import { layoutSelectInput, layoutDispatch } from '../layout/context';
|
|
|
|
import { ACTIONS, PANELS } from '/imports/ui/components/layout/enums';
|
2019-05-17 04:11:10 +08:00
|
|
|
|
2021-10-16 03:07:13 +08:00
|
|
|
const Container = (props) => {
|
|
|
|
const cameraDock = layoutSelectInput((i) => i.cameraDock);
|
|
|
|
const { isResizing } = cameraDock;
|
|
|
|
const layoutContextDispatch = layoutDispatch();
|
|
|
|
|
|
|
|
const { amIModerator } = props;
|
|
|
|
|
|
|
|
if (!amIModerator) {
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_IS_OPEN,
|
|
|
|
value: false,
|
|
|
|
});
|
|
|
|
layoutContextDispatch({
|
|
|
|
type: ACTIONS.SET_SIDEBAR_CONTENT_PANEL,
|
|
|
|
value: PANELS.NONE,
|
|
|
|
});
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <Captions {...{ layoutContextDispatch, isResizing, ...props }} />;
|
|
|
|
};
|
2019-05-17 04:11:10 +08:00
|
|
|
|
2023-11-30 21:24:25 +08:00
|
|
|
export default withTracker(({ amIModerator }) => {
|
2021-10-16 03:07:13 +08:00
|
|
|
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
|
2019-05-17 04:11:10 +08:00
|
|
|
const {
|
2021-10-05 03:22:18 +08:00
|
|
|
locale,
|
2021-10-16 03:07:13 +08:00
|
|
|
name,
|
|
|
|
ownerId,
|
|
|
|
dictating,
|
|
|
|
} = Service.getCaptions();
|
2019-05-17 04:11:10 +08:00
|
|
|
|
|
|
|
return {
|
2021-10-05 03:22:18 +08:00
|
|
|
locale,
|
2021-10-16 03:07:13 +08:00
|
|
|
name,
|
|
|
|
ownerId,
|
|
|
|
dictation: Service.canIDictateThisPad(ownerId),
|
|
|
|
dictating,
|
|
|
|
currentUserId: Auth.userID,
|
|
|
|
isRTL,
|
2023-11-30 21:24:25 +08:00
|
|
|
hasPermission: Service.hasPermission(amIModerator),
|
2019-05-17 04:11:10 +08:00
|
|
|
};
|
2021-10-16 03:07:13 +08:00
|
|
|
})(Container);
|