diff --git a/src/components/Dashboard/ProjectProgressChart.jsx b/src/components/Dashboard/ProjectProgressChart.jsx index 15f19582..afc5e11d 100644 --- a/src/components/Dashboard/ProjectProgressChart.jsx +++ b/src/components/Dashboard/ProjectProgressChart.jsx @@ -5,21 +5,31 @@ import { useDashboard_Data } from "../../hooks/useDashboard_Data"; import { useSelector } from "react-redux"; const ProjectProgressChart = () => { - const selectedProject = useSelector((store) => store.localVariables.projectId); + const selectedProject = useSelector( + (store) => store.localVariables.projectId + ); const { projects } = useProjects(); - const [range, setRange] = useState("1W"); + const [range, setRange] = useState("15D"); const [showAllEmployees, setShowAllEmployees] = useState(false); const getDaysFromRange = (range) => { switch (range) { - case "1D": return 1; - case "1W": return 7; - case "15D": return 15; - case "1M": return 30; - case "3M": return 90; - case "1Y": return 365; - case "5Y": return 1825; - default: return 7; + case "1D": + return 1; + case "1W": + return 7; + case "15D": + return 15; + case "1M": + return 30; + case "3M": + return 90; + case "1Y": + return 365; + case "5Y": + return 1825; + default: + return 7; } }; @@ -27,9 +37,8 @@ const ProjectProgressChart = () => { const today = new Date(); const FromDate = today.toLocaleDateString("en-CA"); - const projectId = showAllEmployees || !selectedProject?.trim() - ? null - : selectedProject; + const projectId = + showAllEmployees || !selectedProject?.trim() ? null : selectedProject; const { dashboard_data, loading: isLineChartLoading } = useDashboard_Data({ days, @@ -53,7 +62,10 @@ const ProjectProgressChart = () => { ]; const lineChartCategories = sortedDashboardData.map((d) => - new Date(d.date).toLocaleDateString("en-US", { month: "short", day: "numeric" }) + new Date(d.date).toLocaleDateString("en-US", { + month: "short", + day: "numeric", + }) ); const lineChartCategoriesDates = sortedDashboardData.map((d) => new Date(d.date).toLocaleDateString("en-US", { @@ -89,7 +101,10 @@ const ProjectProgressChart = () => { checked={showAllEmployees} onChange={(e) => setShowAllEmployees(e.target.checked)} /> -
)} - + {/* Row 2: Time Range Buttons */}