calendar fix contd

This commit was merged in pull request #11.
This commit is contained in:
victorAnumudu
2025-01-18 00:03:20 +01:00
parent 0e2f5f6760
commit b5d0fc5564
5 changed files with 54 additions and 45 deletions
+16 -31
View File
@@ -39,37 +39,22 @@ export default function EventCalendar({draggedEvent, setDraggedEvent}) {
}
}
// const onDrop = useCallback(
// (event) => {
// // if (draggedEvent === 'undroppable') {
// // setDraggedEvent(null)
// // return
// // }
// // let calendarApi;
// // calendarApi.unselect(); // clear date selection
// // calendarApi.addEvent({
// // id: createEventId(),
// // allDay: selectInfo.allDay,
// // end: selectInfo.endStr,
// // start: selectInfo.startStr,
// // title,
// // ...draggedEvent
// // });
// // setDraggedEvent(null)
// console.log('EVENT', event)
// },
// [draggedEvent]
// )
const onDrop =
(dropInfo) => {
console.log('dropInfo', dropInfo)
const onDrop = (event) => {
console.log('event', event)
if(event){
let newEvent = {
id: createEventId(),
title: event.draggedEl.innerText,
start: event.startStr,
end: event.endStr,
allDay: event.allDay,
...event
}
setCurrentEvents(prev => ([...prev, newEvent]))
}
}
function handleEventClick(clickInfo) {
if (
confirm(
@@ -112,9 +97,9 @@ export default function EventCalendar({draggedEvent, setDraggedEvent}) {
eventRemove={function(){}}
*/
dropAccept= '.fc-event'
droppable= {true} // this allows things to be dropped onto the calendar
drop= {onDrop}
drop={onDrop}
/>
</div>
</div>