import type { LifeCycleEvent } from '@types'; import { ExecutionLine } from '../execution-line/index.tsx'; export interface ExecutionListProps { events: LifeCycleEvent[]; } export const ExecutionList = ({ events }: ExecutionListProps) => Object.values( events.reduce>( (accum, event) => ({ // biome-ignore lint/performance/noAccumulatingSpread: ...accum, [event.triggerId]: [...(accum[event.triggerId] ?? []), event].toSorted( (a, b) => (new Date(a.timestamp) > new Date(b.timestamp) ? 0 : 1), ), }), {}, ), ) .map((events) => events[events.length - 1]) .flatMap((event) => (event ? [event] : [])) .map((event) => );