Working indicators

This commit is contained in:
Belen Curcio
2017-09-22 17:38:46 -03:00
parent 3b6bcba055
commit 86687f10d8
3 changed files with 20 additions and 1 deletions
@@ -35,7 +35,7 @@ const CoralHeader = ({
to="/admin/moderate"
activeClassName={styles.active}>
{t('configure.moderate')}
<Indicator />
{(root.premodCount !== 0 || root.reportedCount !== 0) && <Indicator />}
</Link>
)
}
@@ -0,0 +1,16 @@
import {gql} from 'react-apollo';
import withFragments from 'coral-framework/hocs/withFragments';
import Header from '../components/ui/Header';
export default withFragments({
root: gql`
fragment TalkAdmin_Header on RootQuery {
premodCount: commentCount(query: {statuses: [PREMOD]})
reportedCount: commentCount(query: {statuses: [NONE, PREMOD, SYSTEM_WITHHELD], action_type: FLAG})
flaggedUsernamesCount: userCount(query: {
action_type: FLAG,
statuses: [PENDING]
})
}
`
})(Header);
@@ -17,6 +17,7 @@ import withQuery from 'coral-framework/hocs/withQuery';
import {bindActionCreators} from 'redux';
import {getDefinitionName} from 'coral-framework/utils';
import Community from '../routes/Community/containers/Community';
import Header from '../containers/Header';
class LayoutContainer extends Component {
componentWillMount() {
@@ -105,8 +106,10 @@ LayoutContainer.propTypes = {
const withData = withQuery(gql`
query TalkAdmin_initialQuery {
...${getDefinitionName(Header.fragments.root)}
...${getDefinitionName(Community.fragments.root)}
}
${Header.fragments.root}
${Community.fragments.root}
`, {
options: {