2016-09-27 04:29:44 +08:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
|
|
|
|
|
|
|
import EmojiService from './service';
|
|
|
|
import EmojiMenu from './component.jsx';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
// Emoji status of the current user
|
|
|
|
userEmojiStatus: PropTypes.string.isRequired,
|
|
|
|
actions: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
class EmojiContainer extends React.Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
userEmojiStatus,
|
|
|
|
actions,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
2017-06-03 03:25:02 +08:00
|
|
|
<EmojiMenu userEmojiStatus={userEmojiStatus} actions={actions} />
|
2016-09-27 04:29:44 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default createContainer(() => {
|
|
|
|
const data = EmojiService.getEmojiData();
|
|
|
|
|
|
|
|
const {
|
|
|
|
userEmojiStatus,
|
|
|
|
credentials,
|
|
|
|
} = data;
|
|
|
|
|
|
|
|
const { requesterUserId: userId } = credentials;
|
|
|
|
|
|
|
|
return {
|
|
|
|
userEmojiStatus,
|
|
|
|
actions: {
|
|
|
|
setEmojiHandler: (status) => {
|
|
|
|
EmojiService.setEmoji(userId, status);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}, EmojiContainer);
|
|
|
|
|
|
|
|
EmojiContainer.propTypes = propTypes;
|