-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lazy load VenueTimetableDynamic component in venue page (#337)
- Loading branch information
Showing
2 changed files
with
25 additions
and
5 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
src/app/[lang]/(mods-pages)/(venues)/venues/@content/[locationId]/VenueTimetable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use client'; | ||
import Timetable from '@/components/Timetable/Timetable'; | ||
import { renderTimetableSlot } from '@/helpers/timetable_course'; | ||
import { colorMapFromCourses, createTimetableFromCourses } from '@/helpers/timetable'; | ||
import { MinimalCourse } from '@/types/courses'; | ||
import { timetableColors } from '@/const/timetableColors'; | ||
import useUserTimetable from '@/hooks/contexts/useUserTimetable'; | ||
|
||
type VenueTimetableProps = { | ||
courses: MinimalCourse[] | ||
} | ||
const VenueTimetable = ({ courses }: VenueTimetableProps) => { | ||
const { timetableTheme } = useUserTimetable(); | ||
console.log(timetableTheme) | ||
const colorMap = colorMapFromCourses(courses.map(i => i.raw_id), timetableColors[timetableTheme]); | ||
const timetable = createTimetableFromCourses(courses as MinimalCourse[], colorMap); | ||
|
||
return <Timetable timetableData={timetable} renderTimetableSlot={renderTimetableSlot} /> | ||
} | ||
|
||
export default VenueTimetable; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters