diff --git a/src/app/page.tsx b/src/app/page.tsx index 914ca04..8ae96ba 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,18 +2,21 @@ "use client"; import { useEffect, useState } from "react"; -import { Fragment } from "react/jsx-runtime"; -import { Box, Heading, Skeleton, Text } from "@chakra-ui/react"; -import { Icon } from "@iconify/react"; +import { Heading, Skeleton, VStack } from "@chakra-ui/react"; import { useQuery } from "@urql/next"; -import Get30DayStatsQuery from "@/graphql/queries/get30DayStats"; -import GetTotalGroupsQuery from "@/graphql/queries/getTotalGroups"; import lineChartArr from "@/lib/lineChartArray"; import LinksDeletedChart from "./LinksDeletedChart"; import { LineChartArr } from "@/types/LineChartStats"; +import CommandResponsesChart from "./CommandResponsesChart"; +import TimedTriggeredChart from "./TimesTriggeredChart"; +import GetStatsRange from "@/graphql/queries/getStatsRange"; +import StatsList from "./StatsList"; +import GetTotalGroupsQuery from "@/graphql/queries/getTotalGroups"; +import GetTotalStatsQuery from "@/graphql/queries/getTotalStats"; +import GetTodaysStatsQuery from "@/graphql/queries/getTodaysStats"; export default function Home() { - // Total Groups // + // * Total Groups * // const [ { @@ -25,7 +28,23 @@ export default function Home() { query: GetTotalGroupsQuery }); - // 30 Day Stats // + // * Total Stats * // + + const [ + { fetching: totalStatsFetching, data: totalStats, error: totalStatsError } + ] = useQuery({ + query: GetTotalStatsQuery + }); + + // * Today's Stats * // + + const [ + { fetching: todaysStatsFetching, data: todayStats, error: todaysStatsError } + ] = useQuery({ + query: GetTodaysStatsQuery + }); + + // * 30 Day Stats * // // Dates const [currDate, setCurrDate] = useState(); @@ -43,7 +62,7 @@ export default function Home() { error: thirtyDayStatsError } ] = useQuery({ - query: Get30DayStatsQuery, + query: GetStatsRange, variables: { stateDate: currDate, endDate: date30DaysAgo @@ -66,25 +85,36 @@ export default function Home() { ]); return ( - - {`Total number of groups the bot has helped`} - - - {totalGroupsError || !totalGroups || !totalGroups.getTotalGroups ? ( - - ) : ( - `${totalGroups.getTotalGroups}` - )} - - - - - - + + + + + {`30 Day Stats`} + + + + + + + + + + + ); }