diff --git a/ui/src/components/EventTimeline.jsx b/ui/src/components/EventTimeline.jsx index 928a041..135d054 100644 --- a/ui/src/components/EventTimeline.jsx +++ b/ui/src/components/EventTimeline.jsx @@ -47,77 +47,61 @@ export default function EventTimeline() { return {state}; }; - const groupedEvents = useMemo(() => { - return { - CO: events.filter(e => e.camera_zone === 'CO'), - Mill: events.filter(e => e.camera_zone === 'Mill'), - Conveyor: events.filter(e => e.camera_zone === 'Conveyor') - }; + const chronologicalBlocks = useMemo(() => { + const blocks = {}; + events.forEach(ev => { + // Group by Minute (HH:MM) + const timeKey = ev.start_time.substring(0, 5); + if (!blocks[timeKey]) { + blocks[timeKey] = { timeKey, CO: [], Mill: [], Conveyor: [] }; + } + if (ev.camera_zone === 'CO') blocks[timeKey].CO.push(ev); + if (ev.camera_zone === 'Mill') blocks[timeKey].Mill.push(ev); + if (ev.camera_zone === 'Conveyor') blocks[timeKey].Conveyor.push(ev); + }); + + // Sort chronologically + return Object.values(blocks).sort((a, b) => a.timeKey.localeCompare(b.timeKey)); }, [events]); - const renderTimeline = (zone, zoneEvents, index) => ( -
No events recorded.
- ) : ( - zoneEvents.map((ev, i) => ( -{ev.event_description}
-{ev.event_description}
+Location-wise sequential breakdown of events
+Synchronized Swimlane Timeline
No events recorded.
+ ) : ( + chronologicalBlocks.map((block, index) => ( +