Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJustChew committed Aug 26, 2024
2 parents d10dc13 + 6807feb commit 78539f7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/components/Timetable/GroupByDepartmentButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ const GroupByDepartmentButton = ({
};

return (
<Button variant="outline" onClick={handleGroupByDepartment}>
<Button
className="w-full"
variant="outline"
onClick={handleGroupByDepartment}
>
{dict.timetable.actions.group_dept}
</Button>
);
Expand Down
7 changes: 6 additions & 1 deletion src/components/Timetable/HeadlessSyncCourseButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,12 @@ const HeadlessSyncCourseButton = () => {
if (!ais.enabled) return <></>;

return (
<Button variant="outline" onClick={handleSync} disabled={loading}>
<Button
className="w-full"
variant="outline"
onClick={handleSync}
disabled={loading}
>
{!loading ? (
<>
<FolderSync className="w-4 h-4 mr-1" />{" "}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Timetable/TimetableCourseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,9 @@ export const TimetableCourseList = ({
vertical ? verticalListSortingStrategy : rectSwappingStrategy
}
>
{displayCourseData.map((course, index) => (
{displayCourseData.map((course) => (
<TimetableCourseListItem
key={index}
key={course.raw_id}
course={course as MinimalCourse}
hasConflict={
!!timeConflicts.find(
Expand Down
1 change: 1 addition & 0 deletions src/components/Timetable/TimetableSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const TimetableSidebar = ({
<DropdownMenuItem asChild>
<HeadlessSyncCourseButtonDynamic />
</DropdownMenuItem>
<DropdownMenuSeparator />
<DropdownMenuItem asChild>
<GroupByDepartmentButton semester={semester} />
</DropdownMenuItem>
Expand Down
6 changes: 4 additions & 2 deletions src/components/Timetable/TimetableSlotHorizontal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@ const TimetableSlotHorizontal: FC<TimetableSlotProps> = ({
className={`absolute rounded-md transform translate-y-0.5`}
style={{
left:
tableDim.header.width + course.startTime * tableDim.timetable.width,
tableDim.header.width +
course.startTime * tableDim.timetable.width +
2,
top:
tableDim.header.height +
course.dayOfWeek * tableDim.timetable.height +
(fractionIndex - 1) * (tableDim.timetable.height / fraction),
width:
tableDim.timetable.width * (course.endTime - course.startTime + 1) -
4,
height: tableDim.timetable.height / fraction,
height: tableDim.timetable.height / fraction - 4,
backgroundColor: course.color,
color: course.textColor,
}}
Expand Down
8 changes: 5 additions & 3 deletions src/components/Timetable/TimetableSlotVertical.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,14 @@ const TimetableSlotVertical: FC<TimetableSlotProps> = ({
left:
tableDim.header.width +
course.dayOfWeek * tableDim.timetable.width +
(fractionIndex - 1) * (tableDim.timetable.width / fraction),
(fractionIndex - 1) * (tableDim.timetable.width / fraction) +
2,
top:
tableDim.header.height + course.startTime * tableDim.timetable.height,
width: tableDim.timetable.width / fraction - 4,
height:
(course.endTime - course.startTime + 1) * tableDim.timetable.height,
(course.endTime - course.startTime + 1) * tableDim.timetable.height -
4,
backgroundColor: course.color,
}}
{...props}
Expand Down Expand Up @@ -81,7 +83,7 @@ const TimetableSlotVertical: FC<TimetableSlotProps> = ({
{course.course.name_zh}
</span>
) : (
<span className={cn("text-xs font-medium", textAlign)}>
<span className={cn("text-xs font-medium w-full", textAlign)}>
{course.course.name_en}
</span>
))}
Expand Down

0 comments on commit 78539f7

Please sign in to comment.