import BasicWindow from "../../Components/BasicWindow";
import Button from "../../Components/Button";
import BackButton from "../../Components/BackButton";
import { UserListAdmin } from "../../Components/UserListAdmin";
import { useNavigate } from "react-router-dom";
import GetAllUsers from "../../Components/GetAllUsers";
import { useState } from "react";

function AdminManageUsers(): JSX.Element {
  const [users, setUsers] = useState<string[]>([]);
  GetAllUsers({ setUsersProp: setUsers });

  const navigate = useNavigate();

  const content = (
    <>
      <h1 className="font-bold text-[30px] mb-[20px]">Manage Users</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]">
        <UserListAdmin users={users} />
      </div>
    </>
  );

  const buttons = (
    <>
      <Button
        text="Add User"
        onClick={(): void => {
          navigate("/adminAddUser");
        }}
        type="button"
      />
      <BackButton />
    </>
  );

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