mirror of
https://github.com/TurTaskProject/TurTaskWeb.git
synced 2025-12-20 06:24:07 +01:00
Fix capitalization of Dashboard component and add
task statistics to Overview tab
This commit is contained in:
parent
debcbef7ca
commit
c29543407f
@ -11,7 +11,7 @@ import { SideNav } from "./components/navigations/IconSideNav";
|
|||||||
import { Eisenhower } from "./components/EisenhowerMatrix/Eisenhower";
|
import { Eisenhower } from "./components/EisenhowerMatrix/Eisenhower";
|
||||||
import { PrivateRoute } from "./PrivateRoute";
|
import { PrivateRoute } from "./PrivateRoute";
|
||||||
import { ProfileUpdatePage } from "./components/profile/profilePage";
|
import { ProfileUpdatePage } from "./components/profile/profilePage";
|
||||||
import { Dashboard } from "./components/dashboard/dashboard";
|
import { Dashboard } from "./components/dashboard/Dashboard";
|
||||||
import { LandingPage } from "./components/landingPage/LandingPage";
|
import { LandingPage } from "./components/landingPage/LandingPage";
|
||||||
import { PublicRoute } from "./PublicRoute";
|
import { PublicRoute } from "./PublicRoute";
|
||||||
import { useAuth } from "./hooks/AuthHooks";
|
import { useAuth } from "./hooks/AuthHooks";
|
||||||
|
|||||||
@ -9,17 +9,43 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
Title,
|
Title,
|
||||||
Legend,
|
Legend,
|
||||||
|
Metric,
|
||||||
} from "@tremor/react";
|
} from "@tremor/react";
|
||||||
import { KpiCard } from "./KpiCard";
|
import { KpiCard } from "./KpiCard";
|
||||||
import { BarChartGraph } from "./Barchart";
|
import { BarChartGraph } from "./Barchart";
|
||||||
import { AreaChartGraph } from "./Areachart";
|
import { AreaChartGraph } from "./Areachart";
|
||||||
import { DonutChartGraph } from "./PieChart";
|
import { DonutChartGraph } from "./PieChart";
|
||||||
import { ProgressCircleChart } from "./ProgressCircle";
|
import { ProgressCircleChart } from "./ProgressCircle";
|
||||||
|
import { axiosInstance } from "src/api/AxiosConfig";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
|
||||||
const valueFormatter = (number) =>
|
const valueFormatter = (number) =>
|
||||||
`$ ${new Intl.NumberFormat("us").format(number).toString()}`;
|
`$ ${new Intl.NumberFormat("us").format(number).toString()}`;
|
||||||
|
|
||||||
export function Dashboard() {
|
export function Dashboard() {
|
||||||
|
const [totalTask, setTotalTask] = useState(0);
|
||||||
|
const [totalCompletedTasks, settotalCompletedTasks] = useState(0);
|
||||||
|
const [totalCompletedTasksToday, setTotalCompletedTasksToday] = useState(0);
|
||||||
|
const [totalTaskToday, setTotalTaskToday] = useState(0);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const fetchData = async () => {
|
||||||
|
const response = await axiosInstance.get("/dashboard/todostats/");
|
||||||
|
const totalTaskValue = response.data.total_tasks || 0;
|
||||||
|
const totalCompletedTasksValue = response.data.total_completed_tasks || 0;
|
||||||
|
const totalCompletedTasksTodayValue =
|
||||||
|
response.data.total_completed_tasks_today || 0;
|
||||||
|
const totalTaskToday = response.data.total_task_today || 0;
|
||||||
|
|
||||||
|
setTotalTask(totalTaskValue);
|
||||||
|
settotalCompletedTasks(totalCompletedTasksValue);
|
||||||
|
setTotalCompletedTasksToday(totalCompletedTasksTodayValue);
|
||||||
|
setTotalTaskToday(totalTaskToday);
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchData();
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col p-12">
|
<div className="flex flex-col p-12">
|
||||||
<div>
|
<div>
|
||||||
@ -59,8 +85,38 @@ export function Dashboard() {
|
|||||||
</Card>
|
</Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabPanel>
|
</TabPanel>
|
||||||
|
{/*Overview Tab*/}
|
||||||
<TabPanel>
|
<TabPanel>
|
||||||
<Grid numItemsMd={2} numItemsLg={3} className="gap-6 mt-6">
|
<Grid numItemsMd={2} numItemsLg={3} className="gap-6 mt-6">
|
||||||
|
<Card>
|
||||||
|
<Card
|
||||||
|
className="max-w-xs mx-auto"
|
||||||
|
decoration="top"
|
||||||
|
decorationColor="yellow"
|
||||||
|
>
|
||||||
|
<Text>Total tasks</Text>
|
||||||
|
<Metric>{totalTask}</Metric>
|
||||||
|
</Card>
|
||||||
|
<br></br>
|
||||||
|
<Card
|
||||||
|
className="max-w-xs mx-auto"
|
||||||
|
decoration="top"
|
||||||
|
decorationColor="rose"
|
||||||
|
>
|
||||||
|
<Text>Total completed tasks</Text>
|
||||||
|
<Metric>{totalCompletedTasks}</Metric>
|
||||||
|
</Card>
|
||||||
|
<br></br>
|
||||||
|
<Card
|
||||||
|
className="max-w-xs mx-auto"
|
||||||
|
decoration="top"
|
||||||
|
decorationColor="orange"
|
||||||
|
>
|
||||||
|
<Text>Task completed today</Text>
|
||||||
|
<Metric>{totalCompletedTasksToday}</Metric>
|
||||||
|
</Card>
|
||||||
|
</Card>
|
||||||
|
{/*Pie chart graph*/}
|
||||||
<div className="h-31">
|
<div className="h-31">
|
||||||
<Card className="mx-auto h-full">
|
<Card className="mx-auto h-full">
|
||||||
<Title>Tasks</Title>
|
<Title>Tasks</Title>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user