import React from 'react'
import { ClockIcon, ErrorIcon, GreenlightIcon } from '~/resources/icons'
import { EventRecord } from '~/src/types/core'
import { EventTimeline } from '../EventTimeline'
import { Timestamp } from '../Timestamp'
import { useEventDeliveryStatus } from './hooks'
import {
Attribute,
AttributeName,
AttributeValue,
EventTypeHeading,
QuickSummaryTable,
SummaryTableBody
} from './style'
const dateTimeFmtOptions: Intl.DateTimeFormatOptions = {
hour: 'numeric',
minute: 'numeric',
second: 'numeric',
fractionalSecondDigits: 2
}
export const EventDetail = ({ eventRecord }: { eventRecord: EventRecord }) => {
const [eventStatus, statusIcon] = useEventDeliveryStatus(eventRecord)
return (
<>
{eventRecord.event.type} event
Occurrence time
{eventRecord.phases.triggered.timestamp}
Status
{eventStatus}
0 ? ErrorIcon : GreenlightIcon}>
Problems
{eventRecord.errors.length > 0
? `${eventRecord.errors.length} error${eventRecord.errors.length === 1 ? '' : 's'}`
: 'All clear'}
>
)
}