28 lines
1011 B
TypeScript
28 lines
1011 B
TypeScript
|
|
// Dedicated badge for Mythic task statuses — separate from simulation status badges.
|
||
|
|
// submitted / processed → primary-soft (in-flight)
|
||
|
|
// completed → success-soft
|
||
|
|
// error* / fail* → warn-soft (task-level issue, not system error)
|
||
|
|
// anything else → cloud / graphite (unknown/neutral)
|
||
|
|
|
||
|
|
interface C2TaskStatusBadgeProps {
|
||
|
|
status: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
function badgeClass(status: string): string {
|
||
|
|
const s = status.toLowerCase();
|
||
|
|
if (s === 'completed') return 'bg-success-soft text-success';
|
||
|
|
if (s.startsWith('error') || s.startsWith('fail')) return 'bg-warn-soft text-warn';
|
||
|
|
if (s === 'submitted' || s === 'processed') return 'bg-primary-soft text-primary-deep';
|
||
|
|
return 'bg-cloud text-graphite border border-hairline';
|
||
|
|
}
|
||
|
|
|
||
|
|
export function C2TaskStatusBadge({ status }: C2TaskStatusBadgeProps): JSX.Element {
|
||
|
|
return (
|
||
|
|
<span
|
||
|
|
className={`inline-flex items-center rounded-pill px-3 py-[4px] text-[12px] leading-[1.3] font-bold ${badgeClass(status)}`}
|
||
|
|
>
|
||
|
|
{status}
|
||
|
|
</span>
|
||
|
|
);
|
||
|
|
}
|