import { Group, Text, Tooltip } from '@mantine/core'; import { IconAlertTriangle, IconArrowRight, IconCircleCheck, IconCircleDashed, IconMinus, IconX } from '@tabler/icons-react'; import type { ReactNode } from 'react'; import type { ProcessStep } from '../api/types'; import { STEP_STATE } from '../glossary'; const ICON: Record = { failing: , gap: , not_tested: , passed: , not_affected: , }; function detail(s: ProcessStep) { const parts = [STEP_STATE[s.state]?.label ?? s.state]; if (s.scenarios) parts.push(`${s.scenarios} scenario(s) in this test run: ${s.passed} passed${s.flaky ? `, ${s.flaky} passed on retry` : ''}${s.failed ? `, ${s.failed} failing` : ''}${s.not_run ? `, ${s.not_run} not run yet` : ''}`); else parts.push(`${s.library} scenario(s) in the library`); if (s.touched) parts.push('changed by this patch'); return parts.join(' ยท '); } export function StepChip({ s }: { s: ProcessStep }) { const st = STEP_STATE[s.state] ?? { label: s.state, tone: 'neutral' }; return ( {ICON[s.state]}{s.name} {s.scenarios > 0 && {s.passed + s.flaky}/{s.scenarios}} ); } /** A module's business process: the flow steps in order (from the coverage map), cross-cutting steps beside it. */ export function ProcessFlow({ steps, mainOnly = false }: { steps: ProcessStep[]; mainOnly?: boolean }) { const flow = steps.filter((s) => !s.cross_cutting && !s.group); const addon = steps.filter((s) => !s.cross_cutting && s.group); const cross = steps.filter((s) => s.cross_cutting); const row = (list: ProcessStep[], arrows: boolean) => (
{list.map((s, i) => ( {arrows && i > 0 && } ))}
); return (
{row(flow, true)} {!mainOnly && addon.length > 0 &&
{addon[0].group}{row(addon, false)}
} {!mainOnly && cross.length > 0 &&
Across the whole process{row(cross, false)}
}
); } export function StepLegend() { return ( {Object.entries(STEP_STATE).map(([k, v]) => {ICON[k]}{v.label})} ); }