Skip to content

Commit 984cd29

Browse files
Squash
1 parent c771d59 commit 984cd29

File tree

5 files changed

+16
-45
lines changed

5 files changed

+16
-45
lines changed

hooks/useAbsences.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ const convertAbsenceToEvent = (absenceData: AbsenceAPI): EventInput => ({
3131
reasonOfAbsence: absenceData.reasonOfAbsence,
3232
notes: absenceData.notes,
3333
absenceId: absenceData.id,
34-
subject: {
35-
id: absenceData.subject.id,
36-
name: absenceData.subject.name,
37-
},
3834
});
3935

4036
export const useAbsences = () => {

hooks/useUserData.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,5 @@ export const useUserData = (): UseUserDataReturn => {
5959
usedAbsences: fetchedUserData?.usedAbsences ?? 0,
6060
isAuthenticated: status === 'authenticated',
6161
isLoading,
62-
numOfAbsences: 0,
6362
};
6463
};

src/components/AbsenceDetails.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,13 @@ const AbsenceDetails: React.FC<AbsenceDetailsProps> = ({
116116
};
117117
return (
118118
<>
119-
<Modal isOpen={isOpen} onClose={onClose} size="lg" isCentered>
119+
<Modal
120+
isOpen={isOpen}
121+
onClose={onClose}
122+
size="lg"
123+
isCentered
124+
blockScrollOnMount={false}
125+
>
120126
<ModalContent
121127
width="362px"
122128
borderRadius="15px"

src/pages/calendar.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,15 @@ const Calendar: React.FC = () => {
108108
lessonPlan,
109109
} = eventInfo.event.extendedProps;
110110

111-
const eventDate = new Date(eventInfo.event.startStr);
112-
const isPastEvent = eventDate < new Date();
113-
const opacity = isPastEvent ? 0.7 : 1;
111+
const eventDate = new Date(eventInfo.event.start!!);
112+
const now = new Date();
113+
const isSameDay =
114+
eventDate.getFullYear() === now.getFullYear() &&
115+
eventDate.getMonth() === now.getMonth() &&
116+
eventDate.getDate() === now.getDate();
117+
const isPastEvent = eventDate < now && !isSameDay;
118+
119+
const opacity = isPastEvent ? 0.6 : 1;
114120
const createdByUser = absentTeacher.id === userData?.id;
115121

116122
const highlightText = createdByUser

utils/types.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export interface Absence {
99
substituteTeacherId?: number;
1010
locationId: number;
1111
subjectId: number;
12-
lessonPlan?: string | null;
1312
}
1413

1514
export interface LessonPlanFile {
@@ -34,7 +33,6 @@ export interface EventDetails {
3433
reasonOfAbsence: string;
3534
notes: string;
3635
absenceId: number;
37-
subject: { id: number; name: string } | null;
3836
}
3937

4038
export interface AbsenceAPI {
@@ -193,37 +191,3 @@ export interface FilterOptions {
193191
absencesValue: number | null;
194192
disabledTags?: string[] | null;
195193
}
196-
197-
export interface AbsenceUpdate {
198-
lessonDate?: Date | string;
199-
lessonPlan?: string | null;
200-
reasonOfAbsence?: string;
201-
notes?: string | null;
202-
roomNumber?: string | null;
203-
substituteTeacher?: {
204-
firstName: string;
205-
lastName: string;
206-
id: number;
207-
} | null;
208-
absentTeacher?: {
209-
firstName: string;
210-
lastName: string;
211-
id: number;
212-
} | null;
213-
location?: {
214-
id: number;
215-
name: string;
216-
} | null;
217-
subject?: {
218-
id: number;
219-
name: string;
220-
abbreviation: string;
221-
colorGroup: {
222-
colorCodes: string[];
223-
};
224-
} | null;
225-
absentTeacherId?: number;
226-
substituteTeacherId?: number;
227-
locationId?: number;
228-
subjectId?: number;
229-
}

0 commit comments

Comments
 (0)