@@ -26,12 +26,7 @@ import {
26
26
import { useTranslation } from 'react-i18next' ;
27
27
import { useParams } from 'react-router' ;
28
28
import dayjs from 'dayjs' ;
29
- import {
30
- IDataTableRecord ,
31
- IMessage ,
32
- ITransaction ,
33
- IOrganization ,
34
- } from '../interfaces' ;
29
+ import { IDataTableRecord , IMessage , ITransaction } from '../interfaces' ;
35
30
import { DataTable } from '../components/DataTable/DataTable' ;
36
31
import { HashPopover } from '../components/HashPopover' ;
37
32
import { ApplicationContext } from '../contexts/ApplicationContext' ;
@@ -43,9 +38,11 @@ export const Dashboard: () => JSX.Element = () => {
43
38
const classes = useStyles ( ) ;
44
39
const { t } = useTranslation ( ) ;
45
40
const [ messages , setMessages ] = useState < IMessage [ ] > ( [ ] ) ;
46
- const [ data , setData ] = useState < IMessage [ ] > ( [ ] ) ;
41
+ const [ messageTotal , setMessageTotal ] = useState ( 0 ) ;
42
+ const [ orgTotal , setOrgTotal ] = useState ( 0 ) ;
43
+ const [ dataTotal , setDataTotal ] = useState ( 0 ) ;
44
+ const [ txTotal , setTxTotal ] = useState ( 0 ) ;
47
45
const [ transactions , setTransactions ] = useState < ITransaction [ ] > ( [ ] ) ;
48
- const [ orgs , setOrgs ] = useState < IOrganization [ ] > ( [ ] ) ;
49
46
const { lastEvent, createdFilter, setCreatedFilter } =
50
47
useContext ( ApplicationContext ) ;
51
48
const { namespace } = useParams < { namespace : string } > ( ) ;
@@ -101,10 +98,12 @@ export const Dashboard: () => JSX.Element = () => {
101
98
const dataJson = await dataResponse . json ( ) ;
102
99
const txJson = await txResponse . json ( ) ;
103
100
const orgJson = await orgResponse . json ( ) ;
101
+ setMessageTotal ( messageJson . total ) ;
102
+ setDataTotal ( dataJson . total ) ;
103
+ setTxTotal ( txJson . total ) ;
104
+ setOrgTotal ( orgJson . total ) ;
104
105
setMessages ( messageJson . items ) ;
105
106
setTransactions ( txJson . items ) ;
106
- setData ( dataJson . items ) ;
107
- setOrgs ( orgJson . items ) ;
108
107
}
109
108
}
110
109
) ;
@@ -192,16 +191,16 @@ export const Dashboard: () => JSX.Element = () => {
192
191
direction = "row"
193
192
>
194
193
< Grid xs = { 3 } item >
195
- { summaryPanel ( t ( 'networkMembers' ) , orgs . length ) }
194
+ { summaryPanel ( t ( 'networkMembers' ) , orgTotal ) }
196
195
</ Grid >
197
196
< Grid xs = { 3 } item >
198
- { summaryPanel ( t ( 'messages' ) , messages . length ) }
197
+ { summaryPanel ( t ( 'messages' ) , messageTotal ) }
199
198
</ Grid >
200
199
< Grid xs = { 3 } item >
201
- { summaryPanel ( t ( 'transactions' ) , transactions . length ) }
200
+ { summaryPanel ( t ( 'transactions' ) , txTotal ) }
202
201
</ Grid >
203
202
< Grid xs = { 3 } item >
204
- { summaryPanel ( t ( 'data' ) , data . length ) }
203
+ { summaryPanel ( t ( 'data' ) , dataTotal ) }
205
204
</ Grid >
206
205
</ Grid >
207
206
< Grid container item direction = "row" spacing = { 6 } >
0 commit comments