From 07f75914bf768d83c58369461521dd6631316aa8 Mon Sep 17 00:00:00 2001 From: doprz <52579214+doprz@users.noreply.github.com> Date: Wed, 6 Mar 2024 13:10:20 -0600 Subject: [PATCH] chore: refactor --- .vscode/settings.json | 2 +- .../common/CalendarGrid/CalendarGrid.tsx | 52 +++++++------------ 2 files changed, 21 insertions(+), 33 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index e5de7edc..f8561e6f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -8,7 +8,7 @@ "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[typescriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" + "editor.defaultFormatter": "vscode.typescript-language-features" }, "[typescript]": { "editor.defaultFormatter": "esbenp.prettier-vscode" diff --git a/src/views/components/common/CalendarGrid/CalendarGrid.tsx b/src/views/components/common/CalendarGrid/CalendarGrid.tsx index c81fe8f0..c0161ec2 100644 --- a/src/views/components/common/CalendarGrid/CalendarGrid.tsx +++ b/src/views/components/common/CalendarGrid/CalendarGrid.tsx @@ -6,46 +6,34 @@ import { DAY_MAP } from 'src/shared/types/CourseMeeting'; const daysOfWeek = Object.values(DAY_MAP); const hoursOfDay = Array.from({ length: 14 }, (_, index) => index + 8); const grid = Array.from({ length: 5 }, () => - Array.from({ length: 13 }, (_, columnIndex) => ) + Array.from({ length: 13 }, (_, columnIndex) => ) ); /** * Grid of CalendarGridCell components forming the user's course schedule calendar view * @param props */ -const Calendar: React.FC = props => { - return ( -
-
- {daysOfWeek.map((day, dayIndex) => ( -
-
- {/* Empty cell in the top-left corner */} -
- {/* Displaying day labels */} - {daysOfWeek.map(day => ( -
- {day} -
- ))} -
- {/* Displaying the rest of the calendar */} -
-
- {hoursOfDay.map(hour => ( -
-
-

- {hour % 12 === 0 ? 12 : hour % 12}:00 {hour < 12 ? 'AM' : 'PM'} -

-
-
- ))} -
-
{grid.map((row, rowIndex) => row)}
+const Calendar: React.FC = (props) => { + return ( +
+
+ {daysOfWeek.map((day, dayIndex) => ( +
+
+
{day}
+
+ {hoursOfDay.map((hour) => ( +
+
+ {hour}:00 +
+
+ ))}
- ); + ))} +
+ ); }; export default Calendar;