mirror of
https://github.com/wassname/talk.git
synced 2026-07-11 03:37:01 +08:00
assets by like?
This commit is contained in:
@@ -11,7 +11,7 @@ class Dashboard extends React.Component {
|
||||
|
||||
const {data} = this.props;
|
||||
console.log('data', data);
|
||||
const {metrics: assets} = data;
|
||||
const {assetsByLike, assetsByFlag} = data;
|
||||
|
||||
if (data.loading) {
|
||||
return <Spinner />;
|
||||
@@ -25,14 +25,14 @@ class Dashboard extends React.Component {
|
||||
<div className={styles.Dashboard}>
|
||||
<div className={styles.widget}>
|
||||
<h2 className={styles.heading}>Top Ten Articles with the most flagged comments</h2>
|
||||
<FlagWidget assets={assets} />
|
||||
<FlagWidget assets={assetsByFlag} />
|
||||
</div>
|
||||
<div className={styles.widget}>
|
||||
<h2 className={styles.heading}>Top ten comments with the most likes</h2>
|
||||
</div>
|
||||
<div className={styles.widget}>
|
||||
<h2 className={styles.heading}>Top Ten Articles with the most likes</h2>
|
||||
<LikeWidget assets={assets} />
|
||||
<LikeWidget assets={assetsByLike} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
+6
-11
@@ -1,6 +1,10 @@
|
||||
fragment metrics on Asset {
|
||||
id
|
||||
title
|
||||
url
|
||||
commentCount
|
||||
author
|
||||
created_at
|
||||
action_summaries {
|
||||
type: __typename
|
||||
actionCount
|
||||
@@ -9,16 +13,7 @@ fragment metrics on Asset {
|
||||
}
|
||||
|
||||
query Metrics ($from: Date!, $to: Date!, $sort: ACTION_TYPE!) {
|
||||
metrics(from: $from, to: $to, sort: $sort) {
|
||||
id
|
||||
title
|
||||
url
|
||||
commentCount
|
||||
author
|
||||
created_at
|
||||
action_summaries {
|
||||
actionCount
|
||||
actionableItemCount
|
||||
}
|
||||
assetsByFlag: metrics(from: $from, to: $to, sort: $sort) {
|
||||
...metrics
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fragment metrics on Asset {
|
||||
id
|
||||
title
|
||||
url
|
||||
commentCount
|
||||
author
|
||||
created_at
|
||||
action_summaries {
|
||||
type: __typename
|
||||
actionCount
|
||||
actionableItemCount
|
||||
}
|
||||
}
|
||||
|
||||
query Metrics ($from: Date!, $to: Date!, $sort: ACTION_TYPE!) {
|
||||
assetsByLike: metrics(from: $from, to: $to, sort: $sort) {
|
||||
...metrics
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
import {graphql} from 'react-apollo';
|
||||
|
||||
import METRICS from './metrics.graphql';
|
||||
import BY_LIKES from './assetsByLike.graphql';
|
||||
import BY_FLAGS from './assetsByFlag.graphql';
|
||||
import MOD_QUEUE_QUERY from './modQueueQuery.graphql';
|
||||
|
||||
export const mostFlags = graphql(METRICS, {
|
||||
export const mostFlags = graphql(BY_FLAGS, {
|
||||
options: () => {
|
||||
|
||||
// currently hard-coded per Greg's advice
|
||||
@@ -19,7 +20,7 @@ export const mostFlags = graphql(METRICS, {
|
||||
}
|
||||
});
|
||||
|
||||
export const mostLikes = graphql(METRICS, {
|
||||
export const mostLikes = graphql(BY_LIKES, {
|
||||
options: () => {
|
||||
const fiveMinutesAgo = new Date();
|
||||
fiveMinutesAgo.setMinutes(fiveMinutesAgo.getMinutes() - 5);
|
||||
|
||||
Reference in New Issue
Block a user