Skip to content

Commit

Permalink
capped years at 5
Browse files Browse the repository at this point in the history
  • Loading branch information
23langloisj committed Nov 17, 2024
1 parent 0734264 commit 491824b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/frontend/components/Plan/AddYearButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export const AddYearButton: React.FC<AddYearButton> = ({
mutateStudentWithUpdatedPlan(updatedPlan);
};
return (
<BlueButton onClick={addYear} leftIcon={<AddIcon />}>
<BlueButton
onClick={addYear}
leftIcon={<AddIcon />}
isDisabled={plan.schedule.years.length >= 5}
>
Add Year
</BlueButton>
);
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/utils/plan/addEmptyDndYearToPlan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { getCourseCount, prepareYearForDnd } from "./preparePlanForDnd";
export const addEmptyDndYearToPlan = (
plan: PlanModel<string>
): PlanModel<string> => {
// Max 5 years
const updatedPlan = produce(plan, (draftPlan) => {
const schedule = draftPlan.schedule;
const newYearNum = schedule.years.length + 1;
Expand Down

0 comments on commit 491824b

Please sign in to comment.