import React, { useEffect, useState } from "react"; import { NewWeeklyReport } from "../Types/goTypes"; import { Link, useParams } from "react-router-dom"; function AllTimeReportsInProject(): JSX.Element { const { projectName } = useParams(); const [weeklyReports, setWeeklyReports] = useState([]); /* const getWeeklyReports = async (): Promise => { const token = localStorage.getItem("accessToken") ?? ""; const response = await api.getWeeklyReports(token); console.log(response); if (response.success) { setWeeklyReports(response.data ?? []); } else { console.error(response.message); } }; */ const getWeeklyReports = async (): Promise => { const report: NewWeeklyReport[] = [ { projectName: projectName ?? "", week: 10, developmentTime: 1, meetingTime: 1, adminTime: 1, ownWorkTime: 1, studyTime: 1, testingTime: 1, }, { projectName: projectName ?? "", week: 11, developmentTime: 1, meetingTime: 1, adminTime: 1, ownWorkTime: 100, studyTime: 1, testingTime: 1, }, { projectName: projectName ?? "", week: 12, developmentTime: 1, meetingTime: 1, adminTime: 1, ownWorkTime: 1, studyTime: 1, testingTime: 1000, }, { projectName: projectName ?? "", week: 20, developmentTime: 1, meetingTime: 1, adminTime: 1, ownWorkTime: 1, studyTime: 1, testingTime: 10000, }, // Add more reports as needed ]; setWeeklyReports(report); await Promise.resolve(); }; // Call getProjects when the component mounts useEffect(() => { void getWeeklyReports(); }, []); return ( <>
{weeklyReports.map((newWeeklyReport, index) => (

{"Week: "} {newWeeklyReport.week}

{"Total Time: "} {newWeeklyReport.developmentTime + newWeeklyReport.meetingTime + newWeeklyReport.adminTime + newWeeklyReport.ownWorkTime + newWeeklyReport.studyTime + newWeeklyReport.testingTime}{" "} min

{"Signed: "} YES

))}
); } export default AllTimeReportsInProject;