Working respect count

This commit is contained in:
Belen Curcio
2017-03-30 19:41:40 -03:00
parent 78d072a04a
commit 3d245c2029
2 changed files with 11 additions and 9 deletions
+1 -2
View File
@@ -18,7 +18,7 @@ import {queryStream} from 'coral-framework/graphql/queries';
import {postComment, postFlag, postLike, postDontAgree, deleteAction, addCommentTag, removeCommentTag} from 'coral-framework/graphql/mutations';
import {editName} from 'coral-framework/actions/user';
import {updateCountCache} from 'coral-framework/actions/asset';
import {notificationActions, authActions, assetActions, pym, Slot, actions} from 'coral-framework';
import {notificationActions, authActions, assetActions, pym, actions} from 'coral-framework';
import Stream from './Stream';
import InfoBox from 'coral-plugin-infobox/InfoBox';
@@ -135,7 +135,6 @@ class Embed extends Component {
return (
<div style={expandForLogin}>
<div className="commentStream">
{/* <Slot fill="Stream" pluginProps={pluginProps} />*/}
<TabBar onChange={this.changeTab} activeTab={activeTab}>
<Tab><Count count={asset.totalCommentCount}/></Tab>
<Tab>{lang.t('MY_COMMENTS')}</Tab>
+10 -7
View File
@@ -2,25 +2,28 @@ import React from 'react';
import styles from './style.css';
import {Icon} from 'coral-ui';
export default (props) => {
const handleClick = () => {
// props.actions.clic kButton();
const getActionSummary = (type, comment) => comment.action_summaries
.filter((a) => a.__typename === type)[0];
export default (props) => {
const {comment} = props.context;
const handleClick = () => {
props.context.postRespect({
item_id: props.context.comment.id,
item_id: comment.id,
item_type: 'COMMENTS'
});
};
const {clicked} = props.state.respect;
const respectActionSummary = getActionSummary('RespectActionSummary', comment);
return (
<div className={styles.Respect} key={props.key}>
<button
className={clicked ? styles.clicked : ''}
onClick={handleClick}>
Respect
<Icon name="done"/>
<span>9</span>
{respectActionSummary ? <span>{respectActionSummary.count}</span> : null}
</button>
</div>
);