diff --git a/client/coral-admin/src/routes/Community/components/Community.js b/client/coral-admin/src/routes/Community/components/Community.js index 71beb12dd..06eac7f7b 100644 --- a/client/coral-admin/src/routes/Community/components/Community.js +++ b/client/coral-admin/src/routes/Community/components/Community.js @@ -2,7 +2,7 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import styles from './Community.css'; import People from '../containers/People'; -import CommunityMenu from './CommunityMenu'; +import CommunityMenu from '../containers/CommunityMenu'; import RejectUsernameDialog from './RejectUsernameDialog'; import FlaggedAccounts from '../containers/FlaggedAccounts'; @@ -35,11 +35,9 @@ class Community extends Component { } render() { - const { root: { flaggedUsernamesCount } } = this.props; - return (
- +
{this.renderTab()}
); diff --git a/client/coral-admin/src/routes/Community/containers/CommunityMenu.js b/client/coral-admin/src/routes/Community/containers/CommunityMenu.js new file mode 100644 index 000000000..9aa7b3305 --- /dev/null +++ b/client/coral-admin/src/routes/Community/containers/CommunityMenu.js @@ -0,0 +1,30 @@ +import { compose, gql } from 'react-apollo'; +import { mapProps } from 'recompose'; +import withQuery from 'coral-framework/hocs/withQuery'; +import CommunityMenu from '../components/CommunityMenu'; +import get from 'lodash/get'; + +const withData = withQuery( + gql` + query TalkAdmin_CommunityMenu { + flaggedUsernamesCount: userCount( + query: { + action_type: FLAG + state: { status: { username: [SET, CHANGED] } } + } + ) + } + `, + { + options: { + fetchPolicy: 'cache-only', + }, + } +); + +export default compose( + withData, + mapProps(ownProps => ({ + flaggedUsernamesCount: get(ownProps, 'root.flaggedUsernamesCount'), + })) +)(CommunityMenu);