Skip to content

Commit

Permalink
Enhance readability of adding custom events and adjust dialog rows
Browse files Browse the repository at this point in the history
  • Loading branch information
Slo1k committed Jan 7, 2025
1 parent e079db0 commit 11a89f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
24 changes: 13 additions & 11 deletions apps/antalmanac/src/components/Calendar/CourseCalendarEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,20 +286,22 @@ const CourseCalendarEvent = (props: CourseCalendarEventProps) => {
<Paper className={classes.customEventContainer} ref={paperRef}>
<div className={classes.title}>{title}</div>
{building && (
<div className={classes.table}>
Location:&nbsp;
<Link
className={classes.clickableLocation}
to={`/map?location=${building ?? 0}`}
onClick={focusMap}
>
{buildingCatalogue[+building]?.name ?? ''}
</Link>
</div>
<tr className={classes.table}>
<td className={classes.alignToTop}>Location</td>
<td className={classes.rightCells}>
<Link
className={classes.clickableLocation}
to={`/map?location=${building ?? 0}`}
onClick={focusMap}
>
{buildingCatalogue[+building]?.name ?? ''}
</Link>
</td>
</tr>
)}
{term && (
<tr className={classes.table}>
<td className={classes.alignToTop}>Term:&nbsp;</td>
<td className={classes.alignToTop}>Term</td>
<td className={classes.rightCells}>{term}</td>
</tr>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ function CustomEventDialogs(props: CustomEventDialogProps) {
const handleAddToCalendar = () => {
if (!days.some((day) => day) || scheduleIndices.length === 0) return;

const termsShortNames = AppStore.schedule.getCoursesFromSchedules(scheduleIndices).map((course) => course.term);
const termsInScheduleShortNames = AppStore.schedule
.getCoursesFromSchedules(scheduleIndices)
.map((course) => course.term);
const latestTermInSchedule = getLatestTermByShortName(termsInScheduleShortNames)?.shortName;

const newCustomEvent: RepeatingCustomEvent = {
color: props.customEvent ? props.customEvent.color : '#551a8b',
Expand All @@ -122,7 +125,7 @@ function CustomEventDialogs(props: CustomEventDialogProps) {
end: end,
customEventID: props.customEvent ? props.customEvent.customEventID : Date.now(),
building: building,
term: getLatestTermByShortName(termsShortNames)?.shortName,
term: latestTermInSchedule,
};

resetForm();
Expand Down

0 comments on commit 11a89f3

Please sign in to comment.