MCPcopy Create free account
hub / github.com/codeaashu/claude-code / StatusBadge

Function StatusBadge

web/components/tools/ToolUseBlock.tsx:87–125  ·  view source on GitHub ↗
({
  isRunning,
  isError,
  startedAt,
  completedAt,
}: StatusBadgeProps)

Source from the content-addressed store, hash-verified

85}
86
87function StatusBadge({
88 isRunning,
89 isError,
90 startedAt,
91 completedAt,
92}: StatusBadgeProps) {
93 if (isRunning) {
94 return (
95 <span className="flex items-center gap-1.5 text-xs text-brand-400">
96 <Loader2 className="w-3.5 h-3.5 animate-spin" />
97 <ElapsedTimer startMs={startedAt} />
98 </span>
99 );
100 }
101
102 const duration = completedAt ? completedAt - startedAt : null;
103 const durationStr = duration
104 ? duration < 1000
105 ? `${duration}ms`
106 : `${(duration / 1000).toFixed(1)}s`
107 : null;
108
109 if (isError) {
110 return (
111 <span className="flex items-center gap-1.5 text-xs text-red-400">
112 <XCircle className="w-3.5 h-3.5" />
113 {durationStr && <span>{durationStr}</span>}
114 <span>Error</span>
115 </span>
116 );
117 }
118
119 return (
120 <span className="flex items-center gap-1.5 text-xs text-green-400">
121 <CheckCircle2 className="w-3.5 h-3.5" />
122 {durationStr && <span>{durationStr}</span>}
123 </span>
124 );
125}
126
127// ─── Main component ───────────────────────────────────────────────────────────
128

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected