import Row from "@moduletrace/twui/layout/Row"; import Span from "@moduletrace/twui/layout/Span"; import Stack from "@moduletrace/twui/layout/Stack"; import type { BUN_SQLITE_COBBLE_BOT_HOOK_EVENTS } from "@/db/types/db"; import { BotHookEventStatuses } from "@/src/dict/bot-hook-dict"; import relativeTime from "@/src/utils/relative-time"; type Props = { event: BUN_SQLITE_COBBLE_BOT_HOOK_EVENTS; }; /** * One call to a hook: what became of it and when, where it came from, why * it was refused, and the start of what it sent. */ export default function HookEventRow({ event }: Props) { const status = BotHookEventStatuses.find((s) => s.value == event.status)?.title || event.status || ""; const meta = [ status, event.created_at ? relativeTime({ at: Number(event.created_at) }) : "", event.source_ip || "", event.job_id ? `job #${event.job_id}` : "", event.error || "", ] .filter(Boolean) .join(" ยท "); return ( {meta} {event.payload ? ( {event.payload} ) : null} ); }