import { useState } from "react"; import { NewProjMember } from "../Types/goTypes"; import Button from "./Button"; import GetAllUsers from "./GetAllUsers"; import AddMember from "./AddMember"; import BackButton from "./BackButton"; /** * Provides UI for adding a member to a project. * @returns {JSX.Element} - Returns the component UI for adding a member */ function AddUserToProject(): JSX.Element { const [name, setName] = useState(""); const [users, setUsers] = useState([]); const [role, setRole] = useState(""); GetAllUsers({ setUsersProp: setUsers }); const handleClick = (): boolean => { const newMember: NewProjMember = { username: name, projectname: localStorage.getItem("projectName") ?? "", role: role, }; return AddMember({ memberToAdd: newMember }); }; return (

User chosen: [{name}]

Role chosen: [{role}]

Project chosen: [{localStorage.getItem("projectName") ?? ""}]

Choose role:

  • { setRole("member"); }} > {"Member"}
  • { setRole("project_manager"); }} > {"Project manager"}

Choose user:

    {users.map((user) => (
  • { setName(user); }} > {user}
  • ))}

); } export default AddUserToProject;