mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-22 14:51:45 +00:00
Merge pull request #176 from jubnl/main
Prevent duplicate place assignment when dragging to an empty day
This commit is contained in:
@@ -632,6 +632,7 @@ export default function DayPlanSidebar({
|
|||||||
|
|
||||||
const handleDropOnDay = (e, dayId) => {
|
const handleDropOnDay = (e, dayId) => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
setDragOverDayId(null)
|
setDragOverDayId(null)
|
||||||
const { placeId, assignmentId, noteId, fromDayId } = getDragData(e)
|
const { placeId, assignmentId, noteId, fromDayId } = getDragData(e)
|
||||||
if (placeId) {
|
if (placeId) {
|
||||||
@@ -886,6 +887,7 @@ export default function DayPlanSidebar({
|
|||||||
onDragOver={e => { e.preventDefault(); const cur = dropTargetRef.current; if (draggingId && (!cur || cur.startsWith('end-'))) setDropTargetKey(`end-${day.id}`) }}
|
onDragOver={e => { e.preventDefault(); const cur = dropTargetRef.current; if (draggingId && (!cur || cur.startsWith('end-'))) setDropTargetKey(`end-${day.id}`) }}
|
||||||
onDrop={e => {
|
onDrop={e => {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
e.stopPropagation()
|
||||||
const { placeId, assignmentId, noteId, fromDayId } = getDragData(e)
|
const { placeId, assignmentId, noteId, fromDayId } = getDragData(e)
|
||||||
// Drop on transport card (detected via dropTargetRef for sync accuracy)
|
// Drop on transport card (detected via dropTargetRef for sync accuracy)
|
||||||
if (dropTargetRef.current?.startsWith('transport-')) {
|
if (dropTargetRef.current?.startsWith('transport-')) {
|
||||||
|
|||||||
Reference in New Issue
Block a user