diff --git a/frontend/src/components/ProjectsComponents/CreateProjectComponents/InputFields/InfoUrl/InfoUrl.tsx b/frontend/src/components/ProjectsComponents/CreateProjectComponents/InputFields/InfoUrl/InfoUrl.tsx new file mode 100644 index 000000000..24fbe0d97 --- /dev/null +++ b/frontend/src/components/ProjectsComponents/CreateProjectComponents/InputFields/InfoUrl/InfoUrl.tsx @@ -0,0 +1,17 @@ +import { Input } from "../../styles"; + +export default function InfoUrl({ + infoUrl, + setInfoUrl, +}: { + infoUrl: string; + setInfoUrl: (infoUrl: string) => void; +}) { + return ( + setInfoUrl(e.target.value)} + placeholder="Ex. https://osoc.be/" + /> + ); +} diff --git a/frontend/src/components/ProjectsComponents/CreateProjectComponents/InputFields/InfoUrl/index.ts b/frontend/src/components/ProjectsComponents/CreateProjectComponents/InputFields/InfoUrl/index.ts new file mode 100644 index 000000000..071478423 --- /dev/null +++ b/frontend/src/components/ProjectsComponents/CreateProjectComponents/InputFields/InfoUrl/index.ts @@ -0,0 +1 @@ +export { default } from "./InfoUrl"; diff --git a/frontend/src/data/interfaces/projects.ts b/frontend/src/data/interfaces/projects.ts index 8d47ab810..d2272cfbf 100644 --- a/frontend/src/data/interfaces/projects.ts +++ b/frontend/src/data/interfaces/projects.ts @@ -50,6 +50,9 @@ export interface Project { /** The name of the project */ name: string; + /** An url with more info */ + infoUrl: string; + /** The coaches of this project */ coaches: Coach[]; @@ -86,6 +89,9 @@ export interface CreateProject { /** The name of the new project */ name: string; + /** An url with more info */ + infoUrl: string; + /** The partners that belong to this project */ partners: string[]; diff --git a/frontend/src/utils/api/projects.ts b/frontend/src/utils/api/projects.ts index 48f02e00a..d5095c780 100644 --- a/frontend/src/utils/api/projects.ts +++ b/frontend/src/utils/api/projects.ts @@ -69,17 +69,19 @@ export async function getProject(edition: string, projectId: number): Promise { const payload: CreateProject = { name: name, + infoUrl: infoUrl, partners: partners, coaches: coaches, }; try { - const response = await axiosInstance.post("editions/" + edition + "/projects/", payload); + const response = await axiosInstance.post("editions/" + edition + "/projects", payload); const project = response.data as Project; return project; diff --git a/frontend/src/views/projectViews/CreateProjectPage/CreateProjectPage.tsx b/frontend/src/views/projectViews/CreateProjectPage/CreateProjectPage.tsx index c4ba2f9f0..89d05ef4c 100644 --- a/frontend/src/views/projectViews/CreateProjectPage/CreateProjectPage.tsx +++ b/frontend/src/views/projectViews/CreateProjectPage/CreateProjectPage.tsx @@ -24,25 +24,30 @@ import { User } from "../../../utils/api/users/users"; import { toast } from "react-toastify"; import { createProjectRole } from "../../../utils/api/projectRoles"; import { CreateButton } from "../../../components/Common/Buttons"; +import InfoUrl from "../../../components/ProjectsComponents/CreateProjectComponents/InputFields/InfoUrl"; /** * React component of the create project page. * @returns The create project page. */ export default function CreateProjectPage() { - const [name, setName] = useState(""); // States for coaches + const [name, setName] = useState(""); // State for project name + + const [infoUrl, setInfoUrl] = useState(""); // State for info link const [coach, setCoach] = useState(""); - const [coaches, setCoaches] = useState([]); // States for skills + const [coaches, setCoaches] = useState([]); // States for coaches const [skill, setSkill] = useState(""); - const [projectSkills, setProjectSkills] = useState([]); // States for partners + const [projectSkills, setProjectSkills] = useState([]); // States for skills const [partner, setPartner] = useState(""); - const [partners, setPartners] = useState([]); + const [partners, setPartners] = useState([]); // States for partners + const navigate = useNavigate(); const params = useParams(); const editionId = params.editionId!; + return ( @@ -52,7 +57,10 @@ export default function CreateProjectPage() { - + + + + - + - + { coachIds.push(coachToAdd.userId); }); - const response = await createProject(editionId, name, partners, coachIds); + const response = await createProject(editionId, name, infoUrl, partners, coachIds); if (response) { await toast.promise(addProjectRoles(response.projectId), {