/* eslint-disable @typescript-eslint/no-explicit-any */ "use client"; import { Priority, Project, Task, useGetAuthUserQuery, useGetProjectsQuery, useGetTasksByUserQuery, } from "@/state/api"; import React from "react"; import { useAppSelector } from "../redux"; import { DataGrid, GridColDef } from "@mui/x-data-grid"; import Header from "@/app/components/Header"; import { Bar, BarChart, CartesianGrid, Cell, Legend, Pie, PieChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from "recharts"; import { dataGridSxStyles } from "@/lib/utils"; const taskColumns: GridColDef[] = [ { field: "title", headerName: "Title", width: 200 }, { field: "status", headerName: "Status", width: 150, renderCell: (params) => ( {params.value} ), }, { field: "priority", headerName: "Priority", width: 150, renderCell: (params) => ( {params.value} ), }, { field: "dueDate", headerName: "Due Date", width: 150 }, ]; const statusColors = ["#0088FE", "#00C49F", "#FFBB28", "#FF8042"]; const HomePage = () => { const { data: currentUser } = useGetAuthUserQuery({}); const userId = currentUser?.userDetails?.userId ?? null; const { data: tasks, isLoading: tasksLoading, isError: tasksError, } = useGetTasksByUserQuery(userId || "", { skip: userId === null, }); const { data: projects, isLoading: isProjectsLoading } = useGetProjectsQuery(); const isDarkMode = useAppSelector((state) => state.global.isDarkMode); if (tasksLoading || isProjectsLoading) return