-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from Ayobami6/dev_1.0
Talent details implementation deployment
- Loading branch information
Showing
5 changed files
with
441 additions
and
340 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,59 @@ | ||
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 { createExperience } from "../../api/experience.ts"; | ||
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 { createCertification } from '../../api/certifications.ts'; | ||
|
||
function AddCertificateModal({ show, setShow }: modalProps) { | ||
const modalStyle = show ? "showModal" : ""; | ||
const tp = useContext(TalentContext); | ||
const modalStyle = show ? 'showModal' : ''; | ||
const tp = useContext(TalentContext); | ||
|
||
const { talentProfile } = localStorage; | ||
const tal = talentProfile ? JSON.parse(talentProfile as string).talent : {}; | ||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
const formData = new FormData(e.target as HTMLFormElement); | ||
formData.append("talentId", tal._id); | ||
const data = Object.fromEntries(formData); | ||
const { talentProfile } = localStorage; | ||
const tal = talentProfile ? JSON.parse(talentProfile as string).talent : {}; | ||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => { | ||
e.preventDefault(); | ||
const formData = new FormData(e.target as HTMLFormElement); | ||
formData.append('talentId', tal._id); | ||
const data = Object.fromEntries(formData); | ||
|
||
await createExperience(data); | ||
tp.setRefresh(!tp.refresh); | ||
const formElement = e.target as HTMLFormElement; | ||
formElement.reset(); | ||
setShow(false); | ||
}; | ||
await createCertification(data); | ||
tp.setRefresh(!tp.refresh); | ||
const formElement = e.target as HTMLFormElement; | ||
formElement.reset(); | ||
setShow(false); | ||
}; | ||
|
||
return ( | ||
<div className={"Modal " + modalStyle}> | ||
<div className="content"> | ||
<div className={"header-11"}> | ||
<h1>Add Certification Modal</h1>{" "} | ||
<TButton value={"X"} onClick={() => setShow(false)} /> | ||
</div> | ||
<hr /> | ||
<form onSubmit={handleSubmit}> | ||
<div className="form-control"> | ||
<label htmlFor="title">Title</label> | ||
<input type="text" name={"title"} /> | ||
</div> | ||
<div className="form-control"> | ||
<label htmlFor="link">Link</label> | ||
<input type="url" name={"link"} /> | ||
</div> | ||
return ( | ||
<div className={'Modal ' + modalStyle}> | ||
<div className='content'> | ||
<div className={'header-11'}> | ||
<h1>Add Certification Modal</h1>{' '} | ||
<TButton value={'X'} onClick={() => setShow(false)} /> | ||
</div> | ||
<hr /> | ||
<form onSubmit={handleSubmit}> | ||
<div className='form-control'> | ||
<label htmlFor='title'>Title</label> | ||
<input type='text' name={'title'} /> | ||
</div> | ||
<div className='form-control'> | ||
<label htmlFor='link'>Link</label> | ||
<input type='url' name={'link'} /> | ||
</div> | ||
|
||
<div className="form-control"> | ||
<label htmlFor={"description"}>Description</label> | ||
<textarea name={"description"} /> | ||
</div> | ||
{/* add a save button */} | ||
<div className="form-control"> | ||
<TButton value={"Save"} type={"submit"} /> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
<div className='form-control'> | ||
<label htmlFor={'description'}>Description</label> | ||
<textarea name={'description'} /> | ||
</div> | ||
{/* add a save button */} | ||
<div className='form-control'> | ||
<TButton value={'Save'} type={'submit'} /> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default AddCertificateModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.