/* My Reactions Use Datatable together with userReactedMovies view Pros: can use Datatable, pagination, withList, etc. Cons: setting up view can be complex */ import React from 'react'; import { Components, withCurrentUser, registerComponent, withDocument } from 'meteor/vulcan:core'; import Users from 'meteor/vulcan:users'; import mapProps from 'recompose/mapProps'; import Movies from '../../modules/movies/index.js'; const ReactionCell = ({column, document, currentUser}) => const MyReactions = ({results = [], currentUser, loading, loadMore, count, totalCount}) =>
{currentUser ?
{loading ? :
{/* documents list */} {/* load more */} {totalCount > results.length ? {e.preventDefault(); loadMore();}}>Load More ({count}/{totalCount}) :

No more items.

}
}
:
Please log in
}
/* We want the current user's votes to be loaded in memory on the client so we need to wrap this component with withDocument. If we don't, we won't be able to properly filter the list on the client inside the `userReactedMovies` view. */ const options = { collection: Users, fragmentName: 'UserMoviesVotes', }; const mapPropsFunction = props => ({...props, documentId: props.currentUser && props.currentUser._id}); registerComponent('MyReactions', MyReactions, withCurrentUser, mapProps(mapPropsFunction), [withDocument, options]);