diff --git a/client/coral-embed-stream/src/Comment.js b/client/coral-embed-stream/src/Comment.js index 44bdad88e..c43200c71 100644 --- a/client/coral-embed-stream/src/Comment.js +++ b/client/coral-embed-stream/src/Comment.js @@ -112,6 +112,7 @@ class Comment extends React.Component { addCommentTag, removeCommentTag, disableReply, + pluginProps } = this.props; const like = getActionSummary('LikeActionSummary', comment); @@ -160,7 +161,7 @@ class Comment extends React.Component { ? : null } - + @@ -192,7 +193,7 @@ class Comment extends React.Component { removeBest={removeBestTag} /> - +
@@ -246,7 +247,9 @@ class Comment extends React.Component { showSignInDialog={showSignInDialog} reactKey={reply.id} key={reply.id} - comment={reply} />; + comment={reply} + pluginProps={pluginProps} + />; }) } { diff --git a/client/coral-embed-stream/src/Embed.js b/client/coral-embed-stream/src/Embed.js index 603de44cb..f329ba230 100644 --- a/client/coral-embed-stream/src/Embed.js +++ b/client/coral-embed-stream/src/Embed.js @@ -1,5 +1,6 @@ import React, {Component} from 'react'; import {compose} from 'react-apollo'; +import {bindActionCreators} from 'redux'; import {connect} from 'react-redux'; import isEqual from 'lodash/isEqual'; import I18n from 'coral-framework/modules/i18n/i18n'; @@ -17,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} from 'coral-framework'; +import {notificationActions, authActions, assetActions, pym, Slot, actions} from 'coral-framework'; import Stream from './Stream'; import InfoBox from 'coral-plugin-infobox/InfoBox'; @@ -117,10 +118,23 @@ class Embed extends Component { ? asset.comments[0].created_at : new Date(Date.now() - 1000 * 60 * 60 * 24 * 7).toISOString(); + /** + * Plugins Section + * + */ + const {dispatch} = this.props; + const {pluginActions} = actions; + let boundActionCreators = bindActionCreators(pluginActions, dispatch); + + const pluginProps = { + ...this.props, + ...boundActionCreators + }; + return (
- + {lang.t('MY_COMMENTS')} @@ -193,7 +207,7 @@ class Embed extends Component { key={highlightedComment.id} reactKey={highlightedComment.id} comment={highlightedComment} - {...this.props} + pluginProps={pluginProps} /> } + comments={asset.comments} + pluginProps={pluginProps} + />
+ comment={comment} + pluginProps={pluginProps} + /> ) }
diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index 756a25a68..d5a364aee 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -1,13 +1,11 @@ import React, {Component} from 'react'; import {importer as injectPlugins} from 'coral-framework/helpers/importer'; -import actions from 'coral-framework/actions'; class Slot extends Component { render() { - const slotProps = {...this.props, ...actions}; return (
- {injectPlugins(slotProps)} + {injectPlugins(this.props)}
); } diff --git a/client/coral-framework/helpers/importer.js b/client/coral-framework/helpers/importer.js index 929048088..f8130d9d2 100644 --- a/client/coral-framework/helpers/importer.js +++ b/client/coral-framework/helpers/importer.js @@ -38,7 +38,6 @@ function importer ({fill, ...props}) { * addProps add properties to the injected plugins */ plugin.props = { - ...actionsImporter(), ...getConfig(plugin.name), ...props }; diff --git a/plugins/coral-plugin-respect/client/actions.js b/plugins/coral-plugin-respect/client/actions.js index e3dd724f2..21705e201 100644 --- a/plugins/coral-plugin-respect/client/actions.js +++ b/plugins/coral-plugin-respect/client/actions.js @@ -1 +1,6 @@ -export const clickButton = () => ({type: 'BUTTON_CLICKED'}); +const buttonClicked = () => ({type: 'BUTTON_CLICKED'}); + +export const clickButton = () => dispatch => { + console.log('here'); + dispatch(buttonClicked()); +}; diff --git a/plugins/coral-plugin-respect/client/index.js b/plugins/coral-plugin-respect/client/index.js index 9db812fcc..d5ecc5f0d 100644 --- a/plugins/coral-plugin-respect/client/index.js +++ b/plugins/coral-plugin-respect/client/index.js @@ -3,8 +3,7 @@ import styles from './style.css'; export default (props) => (
- {console.log(props)} - +
); diff --git a/plugins/coral-plugin-respect/client/reducer.js b/plugins/coral-plugin-respect/client/reducer.js index 224677585..aa7bbda5e 100644 --- a/plugins/coral-plugin-respect/client/reducer.js +++ b/plugins/coral-plugin-respect/client/reducer.js @@ -6,6 +6,9 @@ const initialState = Map({ export function respect (state = initialState, action) { switch (action.type) { + case 'BUTTON_CLICKED' : + return state + .set('clicked', !state.get('clicked')); default: return state; }