From 8eaac3eaa20aadab7ccc5fd1535777453f7723fe Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Fri, 18 Aug 2017 19:50:56 +0700 Subject: [PATCH] Tiny refactor.. --- .../containers/ProfileContainer.js | 5 +- client/talk-plugin-history/Comment.js | 83 ++++++++++--------- client/talk-plugin-history/CommentHistory.js | 6 +- 3 files changed, 49 insertions(+), 45 deletions(-) diff --git a/client/coral-settings/containers/ProfileContainer.js b/client/coral-settings/containers/ProfileContainer.js index 3423cb6e2..6ffad3c87 100644 --- a/client/coral-settings/containers/ProfileContainer.js +++ b/client/coral-settings/containers/ProfileContainer.js @@ -51,7 +51,7 @@ class ProfileContainer extends Component { }; render() { - const {auth, auth: {user}, asset, showSignInDialog, stopIgnoringUser} = this.props; + const {auth, auth: {user}, showSignInDialog, stopIgnoringUser, root, data} = this.props; const {me} = this.props.root; const loading = this.props.data.loading; @@ -87,7 +87,7 @@ class ProfileContainer extends Component {

{t('framework.my_comments')}

{me.comments.nodes.length - ? + ? :

{t('user_no_comment')}

} ); @@ -138,7 +138,6 @@ const withProfileQuery = withQuery( `); const mapStateToProps = (state) => ({ - asset: state.asset, auth: state.auth }); diff --git a/client/talk-plugin-history/Comment.js b/client/talk-plugin-history/Comment.js index f90362e2d..d1640cb5e 100644 --- a/client/talk-plugin-history/Comment.js +++ b/client/talk-plugin-history/Comment.js @@ -7,54 +7,57 @@ import CommentContent from '../coral-embed-stream/src/components/CommentContent' import t from 'coral-framework/services/i18n'; -const Comment = (props) => { - return ( -
-
- -

- - Story: {props.asset.title ? props.asset.title : props.asset.url} - -

-
-
- +

+
+
+ +
- - ); -}; + ); + } +} Comment.propTypes = { comment: PropTypes.shape({ id: PropTypes.string, body: PropTypes.string }).isRequired, - asset: PropTypes.shape({ - url: PropTypes.string, - title: PropTypes.string - }).isRequired }; export default Comment; diff --git a/client/talk-plugin-history/CommentHistory.js b/client/talk-plugin-history/CommentHistory.js index d584d6a0a..43ae93f1d 100644 --- a/client/talk-plugin-history/CommentHistory.js +++ b/client/talk-plugin-history/CommentHistory.js @@ -22,16 +22,18 @@ class CommentHistory extends React.Component { } render() { - const {link, comments} = this.props; + const {link, comments, data, root} = this.props; return (
{comments.nodes.map((comment, i) => { return ; + />; })}
{comments.hasNextPage &&