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';
|
|
|
|
import CaptionsService from '/imports/ui/components/captions/service';
|
2019-06-22 04:52:54 +08:00
|
|
|
import PadService from './service';
|
2019-06-19 04:13:09 +08:00
|
|
|
import Pad from './component';
|
2019-05-17 04:11:10 +08:00
|
|
|
|
|
|
|
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-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-06-22 04:52:54 +08:00
|
|
|
currentUserId: PadService.getCurrentUser().userId,
|
2019-05-22 03:21:46 +08:00
|
|
|
amIModerator: CaptionsService.amIModerator(),
|
2019-05-17 04:11:10 +08:00
|
|
|
};
|
|
|
|
})(PadContainer);
|