import { Link } from "react-router-dom";
import BackButton from "../../Components/BackButton";
import BasicWindow from "../../Components/BasicWindow";
import Button from "../../Components/Button";
import { ProjectListAdmin } from "../../Components/ProjectListAdmin";
import { Project } from "../../Types/goTypes";
import GetProjects from "../../Components/GetProjects";
import { useState } from "react";

function AdminManageProjects(): JSX.Element {
  const [projects, setProjects] = useState<Project[]>([]);
  GetProjects({ setProjectsProp: setProjects });
  const content = (
    <>
      <h1 className="font-bold text-[30px] mb-[20px]">Manage Projects</h1>
      <div className="border-4 border-black bg-white flex flex-col items-center h-[65vh] w-[50vw] rounded-3xl content-center overflow-scroll space-y-[10vh] p-[30px]">
        <ProjectListAdmin projects={projects} />
      </div>
    </>
  );

  const buttons = (
    <>
      <Link to="/addProject">
        <Button
          text="Add Project"
          onClick={(): void => {
            return;
          }}
          type="button"
        />
      </Link>
      <BackButton />
    </>
  );

  return <BasicWindow content={content} buttons={buttons} />;
}
export default AdminManageProjects;
