Skip to content

S26 02 pr54 --- improvements to modal for creating schedules. - #312

Open
pconrad wants to merge 37 commits into
mainfrom
s26-02-pr54
Open

S26 02 pr54 --- improvements to modal for creating schedules.#312
pconrad wants to merge 37 commits into
mainfrom
s26-02-pr54

Conversation

@pconrad

@pconrad pconrad commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Partial implementation of #215

Cherry picked from: ucsb-cs156-s26/proj-courses-s26-02#48, from the work of s26-02.

All this happens under main search

In this PR, I've changed the functionality of [Create Personal Schedule] to automatically create a schedule without going to the personal schedule tab.

If there are no schedules for the selected quarter, [Create Personal Schedule] will hold parameters for date and time. Clicking Back will not create a schedule, but clicking Save Changes creates a schedule with the class included.

The user can only save changes once they have created a schedule. Otherwise it is only a cancel button

Adjusted SectionTableLoggedin Tests

Extended the character count for name to 25 instead of 15

image image image

@pconrad pconrad changed the title S26 02 pr54 S26 02 pr54 --- improvements to modal for creating schedules. Jun 21, 2026
@pconrad
pconrad requested a review from Copilot July 13, 2026 16:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the “Add to schedule” UX in the main search flow by enhancing the AddToSchedule modal so users can create a personal schedule inline (instead of navigating away), and increases the backend schedule-name limit to support the updated UI behavior.

Changes:

  • Updated AddToScheduleModal to support an “auto-create schedule” mode using a backend mutation, with loading/disable behavior and revised modal controls.
  • Increased personal schedule name max length from 15 to 25 characters in the backend and updated backend tests accordingly.
  • Updated frontend tests for SectionsTable and AddToScheduleModal to reflect the new mutation wiring and UI states.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/main/java/edu/ucsb/cs156/courses/controllers/PersonalSchedulesController.java Raises schedule name length limit to 25 and updates validation messaging.
src/test/java/edu/ucsb/cs156/courses/controllers/PersonalSchedulesControllerTests.java Updates tests to enforce the new 25-character limit and boundary cases.
frontend/src/main/components/PersonalSchedules/AddToScheduleModal.jsx Adds auto-create flow, backend mutation, revised modal UI, and schedule parameter handling.
frontend/src/tests/components/PersonalSchedules/AddToScheduleModal.test.jsx Expands tests to cover new modal modes, mutation callbacks, loading state, and UI behavior.
frontend/src/tests/components/Sections/SectionsTable.loggedIn.test.jsx Adjusts mocks/expectations for additional useBackendMutation usage introduced by the modal.

Comment on lines +47 to +49
const onError = (error) => {
toast(`Error: ${error.response.data.message}`);
};
Comment on lines +68 to +70
const handleModalSaveSchedule = () => {
mutation.mutate(scheduleParams);
};
Comment on lines +72 to +85
const handleCreateClick = () => {
const timeString = new Date().toLocaleString([], {
month: "short",
day: "numeric",
hour: "2-digit",
minute: "2-digit",
});

setScheduleParams({
...scheduleParams,
name: `${timeString} Schedule`,
description: "Auto-generated schedule",
});
setModalMode("auto-create");
Comment on lines +90 to 93
// Checks length of name parameter (length should be 25 chars or less, nonzero)
if (name.length() > 25) {
throw new IllegalArgumentException("name parameter restricted to 25 chars or less");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants