Skip to content

Commit

Permalink
Misc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danielxue committed Sep 10, 2023
1 parent 0f65031 commit b362ba9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions frontend/components/Calender/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface EditEventProps {
event: Event;
}
const EditEventModal = ({ setModalState, mutate, event }: EditEventProps) => {
const { title, description, courseId } = event;
const { title, description, course_id } = event;
const [inputTitle, setTitle] = useState(title);
const [inputDescription, setDescription] = useState(description || "");

Expand All @@ -37,8 +37,8 @@ const EditEventModal = ({ setModalState, mutate, event }: EditEventProps) => {
start: event.start,
end: event.end,
description: inputDescription,
courseId,
endRecurringPeriod: event.endRecurringPeriod,
course_id,
end_recurring_period: event.end_recurring_period,
};
mutate(event.id, newEvent);

Expand Down Expand Up @@ -158,8 +158,8 @@ const NewEventModal = ({
start: startDate.toISOString(),
end: endDate.toISOString(),
description,
courseId,
endRecurringPeriod: null,
course_id: courseId,
end_recurring_period: null,
};
await createEvent(newEvent);
mutate(undefined, undefined, { sendRequest: false });
Expand Down Expand Up @@ -240,12 +240,12 @@ const NewEventModal = ({
);
};

type CaledarProps = {
type CalendarProps = {
courseId: number;
events: Event[];
mutate: mutateResourceListFunction<Event>;
};
export default function Calender(props: CaledarProps) {
export default function Calender(props: CalendarProps) {
const { courseId, events, mutate } = props;
const [editEvent, setEditEvent] = useState<Event | null>(null);

Expand Down
6 changes: 3 additions & 3 deletions frontend/components/Home/Dashboard/EventSidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ const EventSidebar = (props: EventSidebarProps) => {
const studentEvents = data.filter((event) =>
memberships.find(
(membership) =>
event.courseId === membership.course.id &&
event.course_id === membership.course.id &&
membership.kind === Kind.STUDENT
)
);

const instructorEvents = data.filter((event) =>
memberships.find(
(membership) =>
event.courseId === membership.course.id &&
event.course_id === membership.course.id &&
membership.kind !== Kind.STUDENT
)
);
Expand Down Expand Up @@ -104,7 +104,7 @@ const EventSidebar = (props: EventSidebarProps) => {
: instructorEvents.map((ele) => (
<EventCard
event={ele}
course={findCourse(ele.courseId)}
course={findCourse(ele.course_id)}
/>
))}
</Grid.Row>
Expand Down
8 changes: 4 additions & 4 deletions frontend/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,20 +200,20 @@ export type NotificationProps = MutableRefObject<(string) => void>;

export interface PartialEvent {
title: string;
courseId: number;
course_id: number;
description: string | null;
start: string;
end: string;
endRecurringPeriod: string | null;
end_recurring_period: string | null;
}

export interface CalendarEvent {
title: string;
courseId: number;
course_id: number;
description: string | null;
start: Date;
end: Date;
endRecurringPeriod: string | null;
end_recurring_period: string | null;
}

export interface Event extends PartialEvent {
Expand Down

0 comments on commit b362ba9

Please sign in to comment.