2016-09-27 04:29:44 +08:00
|
|
|
import React, { Component, PropTypes } from 'react';
|
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
|
|
|
|
|
|
|
import Button from '/imports/ui/components/button/component';
|
|
|
|
import Dropdown from '/imports/ui/components/dropdown/component';
|
|
|
|
import DropdownTrigger from '/imports/ui/components/dropdown/trigger/component';
|
|
|
|
import DropdownContent from '/imports/ui/components/dropdown/content/component';
|
|
|
|
import DropdownList from '/imports/ui/components/dropdown/list/component';
|
|
|
|
import DropdownListItem from '/imports/ui/components/dropdown/list/item/component';
|
|
|
|
import DropdownListSeparator from '/imports/ui/components/dropdown/list/separator/component';
|
|
|
|
|
|
|
|
const propTypes = {
|
|
|
|
// Emoji status of the current user
|
|
|
|
userEmojiStatus: PropTypes.string.isRequired,
|
|
|
|
actions: PropTypes.object.isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
class EmojiMenu extends Component {
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
const {
|
|
|
|
userEmojiStatus,
|
|
|
|
actions,
|
|
|
|
intl,
|
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Dropdown ref="dropdown">
|
|
|
|
<DropdownTrigger>
|
|
|
|
<Button
|
|
|
|
role="button"
|
|
|
|
label={intl.formatMessage(intlMessages.statusTriggerLabel)}
|
2016-12-06 04:41:24 +08:00
|
|
|
icon="hand"
|
2016-09-27 04:29:44 +08:00
|
|
|
ghost={false}
|
|
|
|
circle={true}
|
|
|
|
hideLabel={false}
|
|
|
|
color="primary"
|
|
|
|
size="lg"
|
|
|
|
|
|
|
|
// FIXME: Without onClick react proptypes keep warning
|
|
|
|
// even after the DropdownTrigger inject an onClick handler
|
|
|
|
onClick={() => null}
|
|
|
|
/>
|
|
|
|
</DropdownTrigger>
|
|
|
|
<DropdownContent placement="top left">
|
|
|
|
<DropdownList>
|
|
|
|
<DropdownListItem
|
2017-03-02 09:03:02 +08:00
|
|
|
icon="hand"
|
2016-09-27 04:29:44 +08:00
|
|
|
label={intl.formatMessage(intlMessages.raiseLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.raiseDesc)}
|
2017-03-02 09:03:02 +08:00
|
|
|
onClick={() => actions.setEmojiHandler('hand')}
|
2016-09-27 04:29:44 +08:00
|
|
|
/>
|
|
|
|
<DropdownListItem
|
2016-12-21 01:18:24 +08:00
|
|
|
icon="happy"
|
|
|
|
label={intl.formatMessage(intlMessages.happyLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.happyDesc)}
|
|
|
|
onClick={() => actions.setEmojiHandler('happy')}
|
|
|
|
/>
|
|
|
|
<DropdownListItem
|
2017-03-02 09:03:02 +08:00
|
|
|
icon="undecided"
|
2016-09-27 04:29:44 +08:00
|
|
|
label={intl.formatMessage(intlMessages.undecidedLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.undecidedDesc)}
|
2017-03-02 09:03:02 +08:00
|
|
|
onClick={() => actions.setEmojiHandler('undecided')}
|
2016-12-21 01:18:24 +08:00
|
|
|
/>
|
|
|
|
<DropdownListItem
|
|
|
|
icon="sad"
|
|
|
|
label={intl.formatMessage(intlMessages.sadLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.sadDesc)}
|
|
|
|
onClick={() => actions.setEmojiHandler('sad')}
|
2016-09-27 04:29:44 +08:00
|
|
|
/>
|
|
|
|
<DropdownListItem
|
|
|
|
icon="confused"
|
|
|
|
label={intl.formatMessage(intlMessages.confusedLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.confusedDesc)}
|
|
|
|
onClick={() => actions.setEmojiHandler('confused')}
|
|
|
|
/>
|
|
|
|
<DropdownListItem
|
2017-03-02 09:03:02 +08:00
|
|
|
icon="time"
|
2016-12-21 01:18:24 +08:00
|
|
|
label={intl.formatMessage(intlMessages.awayLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.awayDesc)}
|
2017-03-02 09:03:02 +08:00
|
|
|
onClick={() => actions.setEmojiHandler('time')}
|
2016-09-27 04:29:44 +08:00
|
|
|
/>
|
|
|
|
<DropdownListItem
|
2017-03-02 09:03:02 +08:00
|
|
|
icon="thumbs_up"
|
2016-12-21 01:18:24 +08:00
|
|
|
label={intl.formatMessage(intlMessages.thumbsupLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.thumbsupDesc)}
|
2017-03-02 09:03:02 +08:00
|
|
|
onClick={() => actions.setEmojiHandler('thumbs_up')}
|
2016-12-21 01:18:24 +08:00
|
|
|
/>
|
|
|
|
<DropdownListItem
|
2017-03-02 09:03:02 +08:00
|
|
|
icon="thumbs_down"
|
2016-12-21 01:18:24 +08:00
|
|
|
label={intl.formatMessage(intlMessages.thumbsdownLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.thumbsdownDesc)}
|
2017-03-02 09:03:02 +08:00
|
|
|
onClick={() => actions.setEmojiHandler('thumbs_down')}
|
2016-12-21 01:18:24 +08:00
|
|
|
/>
|
|
|
|
<DropdownListItem
|
|
|
|
icon="applause"
|
|
|
|
label={intl.formatMessage(intlMessages.applauseLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.applauseDesc)}
|
|
|
|
onClick={() => actions.setEmojiHandler('applause')}
|
2016-09-27 04:29:44 +08:00
|
|
|
/>
|
|
|
|
<DropdownListSeparator/>
|
|
|
|
<DropdownListItem
|
2017-03-02 09:03:02 +08:00
|
|
|
icon="clear_status"
|
2016-09-27 04:29:44 +08:00
|
|
|
label={intl.formatMessage(intlMessages.clearLabel)}
|
|
|
|
description={intl.formatMessage(intlMessages.clearDesc)}
|
2016-10-07 04:42:37 +08:00
|
|
|
onClick={() => actions.setEmojiHandler('none')}
|
2016-09-27 04:29:44 +08:00
|
|
|
/>
|
|
|
|
</DropdownList>
|
|
|
|
</DropdownContent>
|
|
|
|
</Dropdown>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
statusTriggerLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.statusTriggerLabel',
|
|
|
|
defaultMessage: 'Status',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For away status
|
|
|
|
awayLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.awayLabel',
|
|
|
|
defaultMessage: 'Away',
|
|
|
|
},
|
|
|
|
awayDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.awayDesc',
|
|
|
|
defaultMessage: 'Change your status to away',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For raise hand status
|
|
|
|
raiseLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.raiseLabel',
|
|
|
|
defaultMessage: 'Raise',
|
|
|
|
},
|
|
|
|
raiseDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.raiseDesc',
|
|
|
|
defaultMessage: 'Raise your hand to ask a question',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For undecided status
|
|
|
|
undecidedLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.undecidedLabel',
|
|
|
|
defaultMessage: 'Undecided',
|
|
|
|
},
|
|
|
|
undecidedDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.undecidedDesc',
|
|
|
|
defaultMessage: 'Change your status to undecided',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For confused status
|
|
|
|
confusedLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.confusedLabel',
|
|
|
|
defaultMessage: 'Confused',
|
|
|
|
},
|
|
|
|
confusedDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.confusedDesc',
|
|
|
|
defaultMessage: 'Change your status to confused',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For sad status
|
|
|
|
sadLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.sadLabel',
|
|
|
|
defaultMessage: 'Sad',
|
|
|
|
},
|
|
|
|
sadDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.sadDesc',
|
|
|
|
defaultMessage: 'Change your status to sad',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For happy status
|
|
|
|
happyLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.happyLabel',
|
|
|
|
defaultMessage: 'Happy',
|
|
|
|
},
|
|
|
|
happyDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.happyDesc',
|
|
|
|
defaultMessage: 'Change your status to happy',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For confused status
|
|
|
|
clearLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.clearLabel',
|
|
|
|
defaultMessage: 'Clear',
|
|
|
|
},
|
|
|
|
clearDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.clearDesc',
|
|
|
|
defaultMessage: 'Clear your status',
|
|
|
|
},
|
2016-12-21 01:18:24 +08:00
|
|
|
|
|
|
|
// For applause status
|
|
|
|
applauseLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.applauseLabel',
|
|
|
|
defaultMessage: 'Applause',
|
|
|
|
},
|
|
|
|
applauseDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.applauseDesc',
|
|
|
|
defaultMessage: 'Change your status to applause',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For thumbs up status
|
|
|
|
thumbsupLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.thumbsupLabel',
|
|
|
|
defaultMessage: 'Thumbs up',
|
|
|
|
},
|
|
|
|
thumbsupDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.thumbsupDesc',
|
|
|
|
defaultMessage: 'Change your status to thumbs up',
|
|
|
|
},
|
|
|
|
|
|
|
|
// For thumbs-down status
|
|
|
|
thumbsdownLabel: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.thumbsdownLabel',
|
|
|
|
defaultMessage: 'Thumbs down',
|
|
|
|
},
|
|
|
|
thumbsdownDesc: {
|
|
|
|
id: 'app.actionsBar.emojiMenu.thumbsdownDesc',
|
|
|
|
defaultMessage: 'Change your status to thumbs down',
|
|
|
|
},
|
2016-09-27 04:29:44 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
EmojiMenu.propTypes = propTypes;
|
|
|
|
export default injectIntl(EmojiMenu);
|