Skip to content

Commit

Permalink
remove deleted event from events in Calendar.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
qianxuege committed Aug 1, 2024
1 parent b84c8f1 commit 6042770
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/calendar/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FullCalendar from "@fullcalendar/react";
import dayGridPlugin from "@fullcalendar/daygrid";
import timeGridPlugin from "@fullcalendar/timegrid";
import interactionPlugin from '@fullcalendar/interaction';
import { INITIAL_EVENTS, createEventId } from './event-utils';
import { INITIAL_EVENTS, createEventId, handleEventRemoveFC } from './event-utils';
import { DateSelectArg, EventApi, EventClickArg, EventContentArg } from "fullcalendar";

// for dropdown
Expand All @@ -15,10 +15,9 @@ import Select, { SelectChangeEvent } from '@mui/material/Select';

function renderEventContent(eventContent: EventContentArg) {
return (
<div className={`${eventContent.event.allDay ? 'bg-green': 'bg-green'}`}>
<div className={`w-full ${eventContent.event.allDay ? 'bg-green': 'bg-green'}`}>

<b>{eventContent.timeText}</b>
<i>{eventContent.event.title}</i>
<p className="w-full truncate ..."><b>{eventContent.timeText}</b> {eventContent.event.title}</p>
</div>
)
}
Expand Down Expand Up @@ -73,6 +72,7 @@ export default function Calendar({showSearchBar, events, calendarRef}:CalendarPr

const handleEventClick = (clickInfo: EventClickArg) => {
if (confirm(`Are you sure you want to delete the event '${clickInfo.event.title}'`)) {
handleEventRemoveFC(calendarRef, clickInfo.event.id);
clickInfo.event.remove();
}
}
Expand Down

0 comments on commit 6042770

Please sign in to comment.