import React from 'react'; import {Icon} from 'coral-ui'; import styles from './styles.css'; import {I18n} from 'coral-framework'; import translations from './translations.json'; import {withReaction} from 'coral-plugin-api'; const lang = new I18n(translations); class LoveButton extends React.Component { handleClick = () => { const { postReaction, deleteReaction, showSignInDialog, alreadyReacted } = this.props; const {root: {me}, comment} = this.props; // If the current user does not exist, trigger sign in dialog. if (!me) { showSignInDialog(); return; } // If the current user is banned, do nothing. if (me.status === 'BANNED') { return; } if (alreadyReacted()) { deleteReaction(); } else { postReaction(); } }; render() { const {count, alreadyReacted} = this.props; return ( ); } } export default withReaction('love')(LoveButton);