From b8d00ec9ceee3b5fd41e809c6400a6cf435d0ee1 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Thu, 13 Jul 2017 17:29:54 -0300 Subject: [PATCH] Adding go to conversation --- plugin-api/beta/client/actions/stream.js | 1 + plugin-api/beta/client/hocs/index.js | 1 + .../client/components/FeaturedComment.js | 7 +++++-- .../client/components/TabPane.js | 9 +++++++-- .../client/containers/TabPane.js | 11 ++++++++++- 5 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 plugin-api/beta/client/actions/stream.js diff --git a/plugin-api/beta/client/actions/stream.js b/plugin-api/beta/client/actions/stream.js new file mode 100644 index 000000000..0ddb1ba13 --- /dev/null +++ b/plugin-api/beta/client/actions/stream.js @@ -0,0 +1 @@ +export {setActiveTab} from 'coral-embed-stream/src/actions/stream'; diff --git a/plugin-api/beta/client/hocs/index.js b/plugin-api/beta/client/hocs/index.js index fc3150352..a2494a842 100644 --- a/plugin-api/beta/client/hocs/index.js +++ b/plugin-api/beta/client/hocs/index.js @@ -1,2 +1,3 @@ export {default as withReaction} from './withReaction'; export {default as withTags} from './withTags'; +export {default as withFragments} from 'coral-framework/hocs/withFragments'; diff --git a/plugins/talk-plugin-featured-comments/client/components/FeaturedComment.js b/plugins/talk-plugin-featured-comments/client/components/FeaturedComment.js index 6365a08ac..39b7bdfc8 100644 --- a/plugins/talk-plugin-featured-comments/client/components/FeaturedComment.js +++ b/plugins/talk-plugin-featured-comments/client/components/FeaturedComment.js @@ -5,7 +5,7 @@ import {name} from '../../package.json'; import {timeago} from 'coral-framework/services/i18n'; import {Icon} from 'plugin-api/beta/client/components/ui'; -const FeaturedComment = ({comment}) => { +const FeaturedComment = ({comment, setActiveTab}) => { return (
@@ -20,7 +20,10 @@ const FeaturedComment = ({comment}) => { ,{' '}{timeago(comment.created_at)}
- + setActiveTab('all')} + > Go to conversation diff --git a/plugins/talk-plugin-featured-comments/client/components/TabPane.js b/plugins/talk-plugin-featured-comments/client/components/TabPane.js index a6cb53e09..36244c4b7 100644 --- a/plugins/talk-plugin-featured-comments/client/components/TabPane.js +++ b/plugins/talk-plugin-featured-comments/client/components/TabPane.js @@ -1,8 +1,13 @@ import React from 'react'; import FeaturedComment from './FeaturedComment'; -export default ({asset: {featuredComments}}) => ( +export default ({asset: {featuredComments}, setActiveTab}) => (
- {featuredComments.nodes.map((comment) => )} + {featuredComments.nodes.map((comment) => + + )}
); diff --git a/plugins/talk-plugin-featured-comments/client/containers/TabPane.js b/plugins/talk-plugin-featured-comments/client/containers/TabPane.js index 567f52593..fe024355b 100644 --- a/plugins/talk-plugin-featured-comments/client/containers/TabPane.js +++ b/plugins/talk-plugin-featured-comments/client/containers/TabPane.js @@ -1,8 +1,17 @@ +import {connect} from 'react-redux'; +import {bindActionCreators} from 'redux'; import {compose, gql} from 'react-apollo'; -import withFragments from 'coral-framework/hocs/withFragments'; import TabPane from '../components/TabPane'; +import {withFragments} from 'plugin-api/beta/client/hocs'; +import {setActiveTab} from 'plugin-api/beta/client/actions/stream'; + +const mapDispatchToProps = (dispatch) => + bindActionCreators({ + setActiveTab, + }, dispatch); const enhance = compose( + connect(null, mapDispatchToProps), withFragments({ asset: gql` fragment TalkFeatured_TabPane_asset on Asset {