diff --git a/plugins.json b/plugins.json index 6ac303c35..f135d8430 100644 --- a/plugins.json +++ b/plugins.json @@ -5,4 +5,4 @@ "client": [ "coral-plugin-respect" ] -} \ No newline at end of file +} diff --git a/plugins/coral-plugin-respect/client/config.json b/plugins/coral-plugin-respect/client/config.json index 7d822b10f..ef9fed04f 100644 --- a/plugins/coral-plugin-respect/client/config.json +++ b/plugins/coral-plugin-respect/client/config.json @@ -1,4 +1,4 @@ { "name": "Coral Plugin Respect", "slot": "Comment.Detail" -} \ No newline at end of file +} diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 341363571..de23f994b 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -2,6 +2,10 @@ import React from 'react'; import styles from './style.css'; import Icon from './components/Icon'; +import {I18n} from 'coral-framework'; +import translations from './translations.json'; +const lang = new I18n(translations); + import {getActionSummary} from 'coral-framework/utils'; class RespectButton extends React.Component { @@ -15,7 +19,7 @@ class RespectButton extends React.Component { } handleClick = () => { - const {comment, postRespect, showSignInDialog, currentUser} = this.props.context; + const {comment, postRespect, showSignInDialog, currentUser, deleteAction} = this.props.context; const {localPost, localDelete} = this.state; const respect = getActionSummary('RespectActionSummary', comment); const respected = (respect && respect.current_user && !localDelete) || localPost; @@ -54,6 +58,7 @@ class RespectButton extends React.Component { } else { this.setState((prev) => prev.localPost ? {...prev, localPost: null} : {...prev, localDelete: true}); + deleteAction(localPost || respect.current_user.id); } } @@ -61,6 +66,7 @@ class RespectButton extends React.Component { const {comment} = this.props.context; const {localPost, localDelete} = this.state; const respect = getActionSummary('RespectActionSummary', comment); + const respected = (respect && respect.current_user && !localDelete) || localPost; let count = respect ? respect.count : 0; if (localPost) {count += 1;} @@ -68,8 +74,10 @@ class RespectButton extends React.Component { return (
- diff --git a/plugins/coral-plugin-respect/client/style.css b/plugins/coral-plugin-respect/client/style.css index 7933f8d8e..485315bfa 100644 --- a/plugins/coral-plugin-respect/client/style.css +++ b/plugins/coral-plugin-respect/client/style.css @@ -14,11 +14,14 @@ } } - .clicked { + .respected { color: #ffcc00; + i { + color: #161616; + } } i { padding: 0 5px; } -} \ No newline at end of file +}