All files / shared / components RunPhaseIcon.tsx

70.83% Statements 17/24
41.66% Branches 5/12
66.66% Functions 4/6
77.27% Lines 17/22

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2148x   48x   2x               4x 4x              
interface RunPhaseIconProps {
  phase: 'pending' | 'running' | 'succeeded' | 'failed'
}
 
const config: Record<string, { symbol: string; color: string }> = {
  pending: { symbol: '\u25CB', color: 'text-muted-foreground' },
  running: { symbol: '\u25CF', color: 'text-blue-500 animate-pulse' },
  succeeded: { symbol: '\u2713', color: 'text-green-500' },
  failed: { symbol: '\u2717', color: 'text-red-500' },
}
 
export function RunPhaseIcon({ phase }: RunPhaseIconProps) {
  const { symbol, color } = config[phase]
  return (
    <span className={`inline-flex items-center gap-1 ${color}`}>
      <span className="text-base leading-none">{symbol}</span>
      <span className="text-sm">{phase}</span>
    </span>
  )
}