recurring event delete bug

This commit is contained in:
2026-03-28 22:02:21 -04:00
parent f4dfa6eeca
commit 43ff0f450d

View File

@@ -825,7 +825,7 @@ function EventDetailModal({ event, onClose, onEdit, onAvailabilityChange, isTool
</div>
</div>
<div style={{display:'flex',gap:6,flexShrink:0}}>
{(isToolManager||(userId&&event.created_by===userId))&&!isPast&&<button className="btn btn-secondary btn-sm" onClick={()=>{onClose();onEdit();}}>Edit</button>}
{(isToolManager||(!isPast&&userId&&event.created_by===userId))&&<button className="btn btn-secondary btn-sm" onClick={()=>{onClose();onEdit();}}>Edit</button>}
<button className="btn-icon" onClick={onClose}><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg></button>
</div>
</div>
@@ -1614,7 +1614,14 @@ export default function SchedulePage({ isToolManager, isMobile, onProfile, onHel
};
const openDetail = async e => {
try { const { event } = await api.getEvent(e.id); setDetailEvent(event); } catch { toast('Failed to load event','error'); }
try {
const { event } = await api.getEvent(e.id);
// Virtual recurring occurrences carry their own start/end dates — overlay them so
// the modal shows the correct occurrence time and isPast evaluates against the
// occurrence's end_at, not the base event's first-occurrence end_at.
if (e._virtual) { event.start_at = e.start_at; event.end_at = e.end_at; }
setDetailEvent(event);
} catch { toast('Failed to load event','error'); }
};
const handleSaved = () => { load(); setPanel('calendar'); setEditingEvent(null); };