import type { IBlocksNode, ISerialisable } from '@hass-blocks/core'; import { Box, Text } from 'ink'; import type { LifeCycleEvent } from '@types'; import { ExecutionLine } from '../execution-line/index.ts'; interface AutomationProps { automation: IBlocksNode & ISerialisable; events: LifeCycleEvent[]; } export const Automation = ({ automation, events }: AutomationProps) => { const sortedEvents = events.toSorted((a, b) => new Date(a.timestamp) > new Date(b.timestamp) ? 0 : 1, ); const lastEvent = sortedEvents[sortedEvents.length - 1]; return ( {automation.name} {lastEvent ? : Idle} ); };