Updated Api for Stats on Home page

This commit is contained in:
rockyeverlast
2024-05-16 17:55:09 +05:30
parent 7d4b28222c
commit 8fc02f69a8
2 changed files with 27 additions and 9 deletions

View File

@@ -48,6 +48,10 @@ const store = configureStore({
ecoSystem.middleware,
statsApi.middleware,
), // Add blogApi.middleware here
[statsApi.reducerPath]: statsApi.reducer,
},
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(api.middleware, statsApi.middleware),
});
export default store;

View File

@@ -1,22 +1,36 @@
import { Box, Container, Text } from "@chakra-ui/react";
/* eslint-disable no-unused-vars */
import { Box, Container, Spinner, Text } from "@chakra-ui/react";
import { useInView } from "react-intersection-observer";
import CountUp from "react-countup";
import banner from "../../assets/images/Statsbanner.png";
import { useMediaQuery } from "@chakra-ui/react";
import { useGetStatsApiQuery } from "../../Redux/slice/statsSlice";
const StatsContent = {
heading: `Key Statistics`,
};
const Stats = () => {
const { data, isLoading, error } = useGetStatsApiQuery();
console.log(data);
const [isSmallScreen] = useMediaQuery("(max-width: 435px)");
const { ref, inView } = useInView({
threshold: 0.5,
triggerOnce: true,
});
// if (statsIsLoading) {
// return (
// <>
// <Spinner color="#DE858E" />
// </>
// );
// }
// if (statIsLoading) {
// return (
// <>
// <Spinner color="#DE858E" />
// </>
// );
// }
return (
<Box
height={"auto"}
@@ -108,7 +122,7 @@ const Stats = () => {
{inView && (
<CountUp
start={50000000}
end={51400000}
end={statsData?.totalcoins}
delay={0}
style={{
fontSize: `${isSmallScreen ? "23px" : "38px"}`,
@@ -155,7 +169,7 @@ const Stats = () => {
{inView && (
<CountUp
start={10000000}
end={10247786}
end={statData?.tokensCount}
delay={0}
style={{
fontSize: `${isSmallScreen ? "23px" : "38px"}`,
@@ -181,7 +195,7 @@ const Stats = () => {
{inView && (
<CountUp
start={100000}
end={201413}
end={statData?.rubixUsersCount}
delay={0}
style={{
fontSize: `${isSmallScreen ? "23px" : "38px"}`,
@@ -248,7 +262,7 @@ const Stats = () => {
{inView && (
<CountUp
start={50000000}
end={10247786}
end={statData?.curculatingSupplyCount}
delay={0}
style={{
fontSize: `${isSmallScreen ? "23px" : "38px"}`,
@@ -274,7 +288,7 @@ const Stats = () => {
{inView && (
<CountUp
start={10000000}
end={13572940}
end={statData?.transactionsCount}
delay={0}
style={{
fontSize: `${isSmallScreen ? "23px" : "38px"}`,