Cleanup YourProjectsPage
This commit is contained in:
parent
3b8b9bb3f2
commit
08532444f0
1 changed files with 5 additions and 17 deletions
|
@ -1,13 +1,11 @@
|
|||
import { useState, createContext } from "react";
|
||||
import { useState, useEffect } from "react";
|
||||
import { Project } from "../Types/goTypes";
|
||||
import { Link } from "react-router-dom";
|
||||
import BasicWindow from "../Components/BasicWindow";
|
||||
|
||||
export const ProjectNameContext = createContext("");
|
||||
import { api } from "../API/API";
|
||||
|
||||
function UserProjectPage(): JSX.Element {
|
||||
const [projects, setProjects] = useState<Project[]>([]);
|
||||
const [selectedProject, setSelectedProject] = useState("");
|
||||
|
||||
const getProjects = async (): Promise<void> => {
|
||||
const token = localStorage.getItem("accessToken") ?? "";
|
||||
|
@ -24,29 +22,19 @@ function UserProjectPage(): JSX.Element {
|
|||
void getProjects();
|
||||
}, []);
|
||||
|
||||
const handleProjectClick = (projectName: string): void => {
|
||||
setSelectedProject(projectName);
|
||||
};
|
||||
|
||||
const content = (
|
||||
<ProjectNameContext.Provider value={selectedProject}>
|
||||
<>
|
||||
<h1 className="font-bold text-[30px] mb-[20px]">Your Projects</h1>
|
||||
<div className="border-4 border-black bg-white flex flex-col items-center justify-center min-h-[65vh] h-fit w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10vh] p-[30px]">
|
||||
{projects.map((project, index) => (
|
||||
<Link
|
||||
to={`/project/${project.name}`}
|
||||
onClick={() => {
|
||||
handleProjectClick(project.name);
|
||||
}}
|
||||
key={index}
|
||||
>
|
||||
<Link to={`/project/${project.name}`} key={index}>
|
||||
<h1 className="font-bold underline text-[30px] cursor-pointer">
|
||||
{project.name}
|
||||
</h1>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</ProjectNameContext.Provider>
|
||||
</>
|
||||
);
|
||||
|
||||
const buttons = <></>;
|
||||
|
|
Loading…
Add table
Reference in a new issue