2019-05-17 04:11:10 +08:00
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import { Session } from 'meteor/session';
|
2019-06-14 10:18:36 +08:00
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
2019-05-17 04:11:10 +08:00
|
|
|
import Pad from './component';
|
|
|
|
import CaptionsService from '/imports/ui/components/captions/service';
|
|
|
|
|
|
|
|
class PadContainer extends PureComponent {
|
|
|
|
render() {
|
2019-05-29 22:31:27 +08:00
|
|
|
const { children } = this.props;
|
2019-05-17 04:11:10 +08:00
|
|
|
return (
|
|
|
|
<Pad {...this.props}>
|
2019-05-29 22:31:27 +08:00
|
|
|
{children}
|
2019-05-17 04:11:10 +08:00
|
|
|
</Pad>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default withTracker(() => {
|
|
|
|
const locale = Session.get('captionsLocale');
|
|
|
|
const caption = CaptionsService.getCaptions(locale);
|
|
|
|
const {
|
|
|
|
padId,
|
|
|
|
ownerId,
|
|
|
|
readOnlyPadId,
|
|
|
|
} = caption;
|
|
|
|
|
2019-06-14 10:18:36 +08:00
|
|
|
|
|
|
|
const editCaptions = textData => makeCall('vrEditCaptions', textData);
|
|
|
|
|
2019-05-23 22:51:01 +08:00
|
|
|
const { name } = caption ? caption.locale : '';
|
2019-06-14 10:18:36 +08:00
|
|
|
|
2019-05-17 04:11:10 +08:00
|
|
|
return {
|
|
|
|
locale,
|
2019-05-23 22:51:01 +08:00
|
|
|
name,
|
2019-05-17 04:11:10 +08:00
|
|
|
ownerId,
|
|
|
|
padId,
|
|
|
|
readOnlyPadId,
|
2019-05-22 03:21:46 +08:00
|
|
|
amIModerator: CaptionsService.amIModerator(),
|
2019-06-14 10:18:36 +08:00
|
|
|
editCaptions,
|
2019-05-17 04:11:10 +08:00
|
|
|
};
|
|
|
|
})(PadContainer);
|