From 4828e0f5bd0080214ab942af1da213927e70383a Mon Sep 17 00:00:00 2001 From: Jojo Thomas Date: Fri, 20 Oct 2023 14:27:06 +0100 Subject: [PATCH 01/20] updated the talent page --- .../Modal/UpdateCertificateModal.tsx | 49 ++++++++-- .../components/Modal/UpdateEducationModal.tsx | 73 +++++++++++--- .../Modal/UpdateExperienceModal.tsx | 94 +++++++++++++------ .../components/Modal/UpdateProjectModal.tsx | 70 +++++++++++--- .../src/components/Modal/UpdateSkillModal.tsx | 51 ++++++++-- .../Modal/interfaces/modaInterface.ts | 3 +- .../components/talentProfile/AddNewComp.css | 2 +- .../components/talentProfile/AddNewComp.scss | 4 +- client/src/pages/Talent/Talent.tsx | 6 +- 9 files changed, 280 insertions(+), 72 deletions(-) diff --git a/client/src/components/Modal/UpdateCertificateModal.tsx b/client/src/components/Modal/UpdateCertificateModal.tsx index 6f6bf43..bb32514 100644 --- a/client/src/components/Modal/UpdateCertificateModal.tsx +++ b/client/src/components/Modal/UpdateCertificateModal.tsx @@ -1,35 +1,72 @@ import { modalProps } from "./interfaces/modaInterface.ts"; import TButton from "../Button/TButton.tsx"; import "./styles/AddProjectModal.css"; +import { useContext } from "react"; +import { TalentContext } from "../../pages/Talent/Talent.tsx"; +import { + deleteCertification, + updateCertification, +} from "../../api/certifications.ts"; +import { FaEdit, FaTrash } from "react-icons/fa"; function AddCertificateModal({ show, setShow }: modalProps) { const modalStyle = show ? "showModal" : ""; + const tp = useContext(TalentContext); + + const { talentProfile, info } = localStorage; + const tal = talentProfile ? JSON.parse(talentProfile as string).talent : {}; + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault(); + const formData = new FormData(e.target as HTMLFormElement); + formData.append("talentId", tal._id); + const data = Object.fromEntries(formData); + + await updateCertification(info._id, data); + tp.setRefresh(!tp.refresh); + const formElement = e.target as HTMLFormElement; + formElement.reset(); + setShow(false); + }; + const handleDelete = async () => { + await deleteCertification(info._id); + tp.setRefresh(!tp.refresh); + }; return (
-

Update Certification Modal

{" "} +

Add Certification Modal

{" "} setShow(false)} />

-
+
- +
- +
-