Skip to content

Commit

Permalink
disable major select when year is unselected
Browse files Browse the repository at this point in the history
  • Loading branch information
AngelaZQ1 committed Feb 4, 2024
1 parent 6c81c22 commit a7353b9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/frontend/components/Form/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type PlanSelectProps = {
/** Are the field values numbers. */
isNumeric?: boolean;
isSearchable?: boolean;
isDisabled?: boolean;
/** An option in the select dropdown that indicates "no selection". */
noValueOptionLabel?: string;
/** Fuzzy options to use */
Expand All @@ -41,6 +42,7 @@ export const PlanSelect: React.FC<PlanSelectProps> = ({
rules,
isNumeric,
isSearchable,
isDisabled,
noValueOptionLabel,
useFuzzySearch,
}) => {
Expand Down Expand Up @@ -113,6 +115,7 @@ export const PlanSelect: React.FC<PlanSelectProps> = ({
onChange={onChange}
value={selectedOption}
isSearchable={isSearchable}
isDisabled={isDisabled}
defaultValue={noValueOption}
filterOption={filterOptions}
{...fieldRest}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/components/Plan/AddPlanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export const AddPlanModal: React.FC<AddPlanModalProps> = ({
setValue("concentration", "");
}}
rules={{ required: "Major is required." }}
helperText='First select your catalog year. If you still cannot find your major, select "No Major" above.'
isDisabled={!!!catalogYear}
isSearchable
useFuzzySearch
/>
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/components/Plan/EditPlanModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ export const EditPlanModal: React.FC<EditPlanModalProps> = ({ plan }) => {
}}
rules={{ required: "Major is required." }}
isSearchable
isDisabled={!!!catalogYear}
/>
<PlanConcentrationsSelect
catalogYear={catalogYear}
Expand Down

0 comments on commit a7353b9

Please sign in to comment.