|
@ -12,9 +12,7 @@ const MainLayoutConcordiaStatus = () => { |
|
|
contracts: { |
|
|
contracts: { |
|
|
[FORUM_CONTRACT]: { |
|
|
[FORUM_CONTRACT]: { |
|
|
methods: { |
|
|
methods: { |
|
|
numUsers: { cacheCall: numUsersChainData }, |
|
|
getStats: { cacheCall: getStatsChainData }, |
|
|
numTopics: { cacheCall: numTopicsChainData }, |
|
|
|
|
|
numPosts: { cacheCall: numPostsChainData }, |
|
|
|
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
|
}, |
|
@ -23,48 +21,22 @@ const MainLayoutConcordiaStatus = () => { |
|
|
const [numUsers, setNumUsers] = useState(null); |
|
|
const [numUsers, setNumUsers] = useState(null); |
|
|
const [numTopics, setNumTopics] = useState(null); |
|
|
const [numTopics, setNumTopics] = useState(null); |
|
|
const [numPosts, setNumPosts] = useState(null); |
|
|
const [numPosts, setNumPosts] = useState(null); |
|
|
const [numUsersCallHash, setNumUsersCallHash] = useState(null); |
|
|
const [getStatsCallHash, setGetStatsCallHash] = useState(null); |
|
|
const [numTopicsCallHash, setNumTopicsCallHash] = useState(null); |
|
|
const getStatsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getStats[getStatsCallHash]); |
|
|
const [numPostsCallHash, setNumPostsCallHash] = useState(null); |
|
|
|
|
|
const numUsersResult = useSelector((state) => state.contracts[FORUM_CONTRACT].numUsers[numUsersCallHash]); |
|
|
|
|
|
const numTopicsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].numTopics[numTopicsCallHash]); |
|
|
|
|
|
const numPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].numPosts[numPostsCallHash]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (numUsersCallHash === null) { |
|
|
if (getStatsCallHash === null) { |
|
|
setNumUsersCallHash(numUsersChainData()); |
|
|
setGetStatsCallHash(getStatsChainData()); |
|
|
} |
|
|
} |
|
|
}, [numUsersCallHash, numUsersChainData]); |
|
|
}, [getStatsCallHash, getStatsChainData]); |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
useEffect(() => { |
|
|
if (numTopicsCallHash === null) { |
|
|
if (getStatsResult) { |
|
|
setNumTopicsCallHash(numTopicsChainData()); |
|
|
setNumUsers(parseInt(getStatsResult.value[0], 10)); |
|
|
|
|
|
setNumTopics(parseInt(getStatsResult.value[1], 10)); |
|
|
|
|
|
setNumPosts(parseInt(getStatsResult.value[2], 10)); |
|
|
} |
|
|
} |
|
|
}, [numTopicsCallHash, numTopicsChainData]); |
|
|
}, [getStatsResult]); |
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
if (numPostsCallHash === null) { |
|
|
|
|
|
setNumPostsCallHash(numPostsChainData()); |
|
|
|
|
|
} |
|
|
|
|
|
}, [numPostsCallHash, numPostsChainData]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
if (numUsersResult) { |
|
|
|
|
|
setNumUsers(parseInt(numUsersResult.value, 10)); |
|
|
|
|
|
} |
|
|
|
|
|
}, [numUsersResult]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
if (numTopicsResult) { |
|
|
|
|
|
setNumTopics(parseInt(numTopicsResult.value, 10)); |
|
|
|
|
|
} |
|
|
|
|
|
}, [numTopicsResult]); |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
|
|
if (numPostsResult) { |
|
|
|
|
|
setNumPosts(parseInt(numPostsResult.value, 10)); |
|
|
|
|
|
} |
|
|
|
|
|
}, [numPostsResult]); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<StatusSegment |
|
|
<StatusSegment |
|
|