From 93c1ecd12d88dbd3da3af863f8398e860497e6bf Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Mon, 28 Aug 2017 16:25:26 -0300 Subject: [PATCH 01/11] My Comment Reactions --- client/coral-framework/utils/index.js | 8 +++++++ .../containers/ProfileContainer.js | 5 ++++ client/talk-plugin-history/Comment.css | 11 +++++++-- client/talk-plugin-history/Comment.js | 24 ++++++++++++++----- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/client/coral-framework/utils/index.js b/client/coral-framework/utils/index.js index 533ed85db..df264d360 100644 --- a/client/coral-framework/utils/index.js +++ b/client/coral-framework/utils/index.js @@ -184,3 +184,11 @@ export function getShallowChanges(a, b) { return union(Object.keys(a), Object.keys(b)) .filter((key) => a[key] !== b[key]); } + +export function getTotalReactionsCount(actionSummaries) { + return actionSummaries + .filter((s) => s.__typename !== 'FlagActionSummary') + .reduce((total, summary) => { + return total + summary.count; + }, 0); +} diff --git a/client/coral-settings/containers/ProfileContainer.js b/client/coral-settings/containers/ProfileContainer.js index f5ea64005..907839a92 100644 --- a/client/coral-settings/containers/ProfileContainer.js +++ b/client/coral-settings/containers/ProfileContainer.js @@ -108,6 +108,11 @@ const CommentFragment = gql` nodes { id body + replyCount + action_summaries { + count + __typename + } asset { id title diff --git a/client/talk-plugin-history/Comment.css b/client/talk-plugin-history/Comment.css index 646e1f054..ba63aaeb1 100644 --- a/client/talk-plugin-history/Comment.css +++ b/client/talk-plugin-history/Comment.css @@ -6,6 +6,7 @@ display: flex; align-items: baseline; justify-content: space-between; + padding-bottom: 20px; } .myComment:last-child { @@ -16,11 +17,17 @@ text-decoration: none; font-weight: bold; font-size: 12px; - color: #2c3e50; + color: #757575; } -.commentBody { +.commentSummary { + font-size: 14px; + margin: 30px 0 10px; + color: #424242; +} +.commentSummaryReactions { + margin-right: 5px; } .sidebar { diff --git a/client/talk-plugin-history/Comment.js b/client/talk-plugin-history/Comment.js index 4cf9d875c..f3bb47914 100644 --- a/client/talk-plugin-history/Comment.js +++ b/client/talk-plugin-history/Comment.js @@ -4,6 +4,8 @@ import styles from './Comment.css'; import Slot from 'coral-framework/components/Slot'; import PubDate from '../talk-plugin-pubdate/PubDate'; import CommentContent from '../coral-embed-stream/src/components/CommentContent'; +import cn from 'classnames'; +import {getTotalReactionsCount} from 'coral-framework/utils'; import t from 'coral-framework/services/i18n'; @@ -11,24 +13,34 @@ class Comment extends React.Component { render() { const {comment, link, data, root} = this.props; + // console.log(comment.action_summaries, getTotalReactionsCount(comment.action_summaries)); + return (
-

- + + {getTotalReactionsCount(comment.action_summaries)} reactions + + + + {comment.replyCount} replies + +

+
+ Story: {comment.asset.title ? comment.asset.title : comment.asset.url} -

+