Skip to content

Commit

Permalink
feat(calendar): hide bottom actions if no courses enrolled
Browse files Browse the repository at this point in the history
  • Loading branch information
jsun969 committed Dec 7, 2024
1 parent 1e888fc commit 6e40df8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ import { create } from 'zustand';

import { WEEK_DAYS } from '../constants/week-days';
import { YEAR } from '../constants/year';
import { useCourseColor, useEnrolledCourse } from '../data/enrolled-courses';
import {
useCourseColor,
useEnrolledCourse,
useEnrolledCourses,
} from '../data/enrolled-courses';
import { useCalendar, useOtherWeekCourseTimes } from '../helpers/calendar';
import { useCalendarHourHeight } from '../helpers/calendar-hour-height';
import { useExportCalendar } from '../helpers/export-calendar';
Expand Down Expand Up @@ -420,6 +424,8 @@ export const Calendar = () => {
},
});

const noCourses = useEnrolledCourses((s) => s.courses.length === 0);

return (
<div ref={ref} className="touch-pan-y">
<CalendarHeader
Expand All @@ -431,7 +437,7 @@ export const Calendar = () => {
<CalendarBg currentWeek={currentWeek} />
<CalendarCourses courses={courses} currentWeek={currentWeek} />
{isDragging && <CalendarCourseOtherTimes currentWeek={currentWeek} />}
<EndActions />
{!noCourses && <EndActions />}
</div>
</div>
);
Expand Down

0 comments on commit 6e40df8

Please sign in to comment.