diff --git a/frontend/src/Components/AllTimeReportsInProjectOtherUser.tsx b/frontend/src/Components/AllTimeReportsInProjectOtherUser.tsx index 4fa9ad8..09ca6dc 100644 --- a/frontend/src/Components/AllTimeReportsInProjectOtherUser.tsx +++ b/frontend/src/Components/AllTimeReportsInProjectOtherUser.tsx @@ -1,19 +1,19 @@ //Info: This component is used to display all the time reports for a project. It will display the week number, //total time spent, and if the report has been signed or not. The user can click on a report to edit it. import { useEffect, useState } from "react"; -import { WeeklyReport } from "../Types/goTypes"; +import { NewWeeklyReport } from "../Types/goTypes"; import { Link, useParams } from "react-router-dom"; -import { api } from "../API/API"; /** * Renders a component that displays all the time reports for a specific project. * @returns {JSX.Element} representing the component. */ function AllTimeReportsInProject(): JSX.Element { + const { username } = useParams(); const { projectName } = useParams(); - const [weeklyReports, setWeeklyReports] = useState([]); + const [weeklyReports, setWeeklyReports] = useState([]); - // Call getProjects when the component mounts + /* // Call getProjects when the component mounts useEffect(() => { const getWeeklyReports = async (): Promise => { const token = localStorage.getItem("accessToken") ?? ""; @@ -27,17 +27,49 @@ function AllTimeReportsInProject(): JSX.Element { } else { console.error(response.message); } - }; + }; */ + // Mock data + const getWeeklyReports = async (): Promise => { + // Simulate a delay + await Promise.resolve(); + const mockWeeklyReports: NewWeeklyReport[] = [ + { + projectName: "Project 1", + week: 1, + developmentTime: 10, + meetingTime: 2, + adminTime: 1, + ownWorkTime: 3, + studyTime: 4, + testingTime: 5, + }, + { + projectName: "Project 1", + week: 2, + developmentTime: 8, + meetingTime: 2, + adminTime: 1, + ownWorkTime: 3, + studyTime: 4, + testingTime: 5, + }, + // Add more reports as needed + ]; + // Use the mock data instead of the real data + setWeeklyReports(mockWeeklyReports); + }; + useEffect(() => { void getWeeklyReports(); - }, [projectName]); + }, []); return ( <> +

{username}'s Time Reports

{weeklyReports.map((newWeeklyReport, index) => ( @@ -58,7 +90,7 @@ function AllTimeReportsInProject(): JSX.Element {

{"Signed: "} - {newWeeklyReport.signedBy ? "YES" : "NO"} + NO