import { useMemo } from 'react' import { DeliveredIcon, SentIcon, UndeliverableIcon } from '~/resources/icons' import { EventRecord } from '../..' export const useEventDeliveryStatus = (eventRecord: EventRecord) => useMemo(() => { if (eventRecord.errors.some((error) => error.fatal)) { return ['Undeliverable', UndeliverableIcon] } return 'delivered' in eventRecord.phases ? ['Sent', DeliveredIcon] : ['Enqueued', SentIcon] }, [eventRecord])