Add ProjectNameContext to NewWeeklyReport and handle project selection in YourProjectsPage

This commit is contained in:
Davenludd 2024-03-18 12:49:58 +01:00
parent 164ff781b3
commit 3f8d56963b
2 changed files with 23 additions and 5 deletions

View file

@ -3,6 +3,7 @@ import { NewWeeklyReport } from "../Types/goTypes";
import { api } from "../API/API";
import { useNavigate } from "react-router-dom";
import Button from "./Button";
import { ProjectNameContext } from "../Pages/YourProjectsPage";
export default function NewWeeklyReport(): JSX.Element {
const [week, setWeek] = useState(0);
@ -13,7 +14,7 @@ export default function NewWeeklyReport(): JSX.Element {
const [studyTime, setStudyTime] = useState(0);
const [testingTime, setTestingTime] = useState(0);
// const projectName = useContext(projectNameContext);
const projectName = useContext(ProjectNameContext);
const token = localStorage.getItem("accessToken") ?? "";
const handleNewWeeklyReport = async (): Promise<void> => {