Files
talk/plugins/talk-plugin-featured-comments/client/containers/Tab.js
T
2018-01-11 20:00:34 -07:00

22 lines
621 B
JavaScript

import Tab from '../components/Tab';
import { withFragments, excludeIf } from 'plugin-api/beta/client/hocs';
import { compose, gql } from 'react-apollo';
import { withProps } from 'recompose';
const enhance = compose(
withFragments({
asset: gql`
fragment TalkFeaturedComments_Tab_asset on Asset {
featuredCommentsCount: totalCommentCount(tags: ["FEATURED"])
@skip(if: $hasComment)
}
`,
}),
excludeIf(props => props.asset.featuredCommentsCount === 0),
withProps(props => ({
featuredCommentsCount: props.asset.featuredCommentsCount,
}))
);
export default enhance(Tab);