import { h } from 'preact' import type { TraceMessage } from '../hooks/useConnection' import MetricCard from './MetricCard' interface TraceDetailProps { readonly trace: TraceMessage | undefined } function formatDuration(ms: number): string { if (ms >= 1000) { return `${(ms / 1000).toFixed(2)}s` } return `${ms.toFixed(2)}ms` } function outcomeColor(outcome: string): string { if (outcome === 'render') { return 'var(--color-success)' } if (outcome === 'error') { return 'var(--color-error)' } return 'var(--accent)' } function capitalize(value: string): string { return value.charAt(0).toUpperCase() + value.slice(1) } export default function TraceDetail({ trace }: TraceDetailProps) { if (!trace) { return
{trace.trace.error.stack}