All files / shared / components RunPhaseIcon.tsx

66.66% Statements 14/21
41.66% Branches 5/12
60% Functions 3/5
73.68% Lines 14/19

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 2154x   54x                                    
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>
  )
}