Skip to content

Commit

Permalink
feat/contributions: Fixed validation issue (#1527)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thangaraj-Ideas2it authored Nov 13, 2023
2 parents 33eb7d2 + 2543a65 commit 99083e9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function validateContributionForm(fValues) {
} if(exp.endDate && exp.endDate.getTime() >= new Date().getTime()) {
formErrors.push({id: expIndex, name: `Project ${exp.projectName ? exp.projectName : expIndex + 1}`, field: 'date', error: "Your contribution cannot end in a future date"})
} if(exp.endDate && exp.startDate.getTime() >= exp.endDate.getTime()) {
formErrors.push({id: expIndex, field: 'date', error: "Your contribution end date cannot be less than or equal to from date"})
formErrors.push({id: expIndex, field: 'date', error: "Your contribution end date cannot be less than or equal to start date"})
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function validateContributionForm(fValues) {
} if(exp.endDate && exp.endDate.getTime() >= new Date().getTime()) {
formErrors.push({id: expIndex, name: `Project ${exp.projectName ? exp.projectName : expIndex + 1}`, field: 'date', error: "Your contribution cannot end in a future date"})
} if(exp.endDate && exp.startDate.getTime() >= exp.endDate.getTime()) {
formErrors.push({id: expIndex, name: `Project ${exp.projectName ? exp.projectName : expIndex + 1}`, field: 'date', error: "Your contribution end date cannot be less than or equal to from date"})
formErrors.push({id: expIndex, name: `Project ${exp.projectName ? exp.projectName : expIndex + 1}`, field: 'date', error: "Your contribution end date cannot be less than or equal to start date"})
}
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function ProjectContributionForm(props) {
<div className="flex-1 flex flex-col my-[20px] gap-[12px]">
<div className="flex items-center justify-between">
<label className="text-[14px] font-[600]">Project Name*</label>
{showAddProject && <p className="text-[12px] flex gap-[6px] items-center">{`Can't find your project ?`}<a className="text-blue-600 -ml-[3px]" onClick={onAddNewProject} target="_blank" href="/projects/add">Add here</a></p>}
{showAddProject && <p className="text-[12px] flex gap-[6px] items-center">{`Can't find your project?`}<a className="text-blue-600 -ml-[3px]" onClick={onAddNewProject} target="_blank" href="/projects/add">Add here</a></p>}
</div>
{/* <input maxLength={100} placeholder="Ex: Filecoin" className="text-[14px] mt-[12px] border-solid border-[1px] border-[#CBD5E1] px-[12px] py-[8px] rounded-[8px] w-full" type="text" value={exp.companyName} onChange={(e) => onItemChange(expIndex, 'companyName', e.target.value)} /> */}
<ProjectSelection selectedProj={exp?.project} onProjectSelected={onProjectSelected}/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function ValidationErrorMessages({
))}
</ul>
</div>
{ errors?.contribution?.length > 0 && <div className="w-full text-base mt-2 font-semibold"> Contribution </div>}
{ errors?.contribution?.length > 0 && <div className="w-full text-base mt-2 font-semibold"> Contributions </div>}
<div className="w-full rounded-lg bg-white px-5 py-2">
<ul className="list-inside list-disc space-y-1 text-xs text-red-500">
{errors?.contribution?.map((item, index) => (
Expand Down

0 comments on commit 99083e9

Please sign in to comment.