Skip to content

Commit

Permalink
change condition for disabling button
Browse files Browse the repository at this point in the history
  • Loading branch information
BrandonLim8890 committed Apr 10, 2024
1 parent 1e31164 commit a444292
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions packages/frontend/components/Plan/AddPlanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,13 @@ export const AddPlanModal: React.FC<AddPlanModalProps> = ({
yearSupportedMajors?.[majorName ?? ""]?.verified ?? false;

const isValidForm =
title &&
catalogYear &&
majorName &&
(!isConcentrationRequired || concentration) &&
(!isValidatedMajor ? agreeToBetaMajor : true);
(title &&
catalogYear &&
majorName &&
(!isConcentrationRequired || concentration) &&
(!isValidatedMajor ? agreeToBetaMajor : true)) ||
// Valid plan for no major selected
(title && isNoMajorSelected);

const noMajorHelperLabel = (
<Stack>
Expand Down
12 changes: 7 additions & 5 deletions packages/frontend/components/Plan/EditPlanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,13 @@ export const EditPlanModal: React.FC<EditPlanModalProps> = ({ plan }) => {
yearSupportedMajors?.[majorName ?? ""]?.verified ?? false;

const isValidForm =
title &&
catalogYear &&
majorName &&
(!isConcentrationRequired || concentration) &&
(!isValidatedMajor ? agreeToBetaMajor : true);
(title &&
catalogYear &&
majorName &&
(!isConcentrationRequired || concentration) &&
(!isValidatedMajor ? agreeToBetaMajor : true)) ||
// Valid plan for no major selected
(title && isNoMajorSelected);

const onSubmitHandler = async (payload: UpdatePlanDto) => {
// no submitting till the curr plan has been fetched
Expand Down

0 comments on commit a444292

Please sign in to comment.