@@ -60,11 +60,19 @@ const runStatusStyles: Record<string, { label: string; color: string; pulse?: bo
6060 blocked : { label : "Blocked" , color : "bg-amber-500" } , stopping : { label : "Stopping" , color : "bg-amber-500" } , succeeded : { label : "Succeeded" , color : "bg-emerald-500" } , done : { label : "Done" , color : "bg-emerald-500" } ,
6161 failed : { label : "Failed" , color : "bg-red-500" } , stopped : { label : "Stopped" , color : "bg-slate-500" } , ignored : { label : "Ignored" , color : "bg-slate-400" } ,
6262} ;
63- export function RunStatusDot ( { state, failureSource , decorative = false } : { state : string ; failureSource ?: string | null ; decorative ?: boolean } ) {
63+ function runStatusDetails ( state : string , failureSource ?: string | null ) {
6464 const base = runStatusStyles [ state ] ?? { label : state || "Unknown" , color : "bg-slate-400" } ;
65- const status = state === "failed" && failureSource ? { ...base , label : failureSource === "agent" ? "Agent failed" : "System failed" } : base ;
65+ return state === "failed" && failureSource ? { ...base , label : failureSource === "agent" ? "Agent failed" : "System failed" } : base ;
66+ }
67+ export function RunStatusDot ( { state, failureSource, decorative = false } : { state : string ; failureSource ?: string | null ; decorative ?: boolean } ) {
68+ const status = runStatusDetails ( state , failureSource ) ;
6669 return < span role = { decorative ? undefined : "img" } aria-label = { decorative ? undefined : `Status: ${ status . label } ` } aria-hidden = { decorative || undefined } title = { status . label } className = { `inline-block size-2.5 rounded-full ${ status . color } ${ status . pulse ? "motion-safe:animate-pulse" : "" } ` } /> ;
6770}
71+ export function RunStatusLabel ( { state, failureSource, className = "" } : { state : string ; failureSource ?: string | null ; className ?: string } ) {
72+ const status = runStatusDetails ( state , failureSource ) ;
73+ const text = state === "failed" && failureSource ? status . label : state || "Unknown" ;
74+ return < span role = "img" aria-label = { `Status: ${ status . label } ` } className = { `inline-flex items-center gap-2 ${ className } ` } > < RunStatusDot state = { state } failureSource = { failureSource } decorative /> < span className = "first-letter:uppercase" > { text } </ span > </ span > ;
75+ }
6876export function Button ( { variant = "secondary" , className = "" , ...props } : ComponentProps < "button" > & { variant ?: keyof typeof buttonClasses } ) {
6977 return < button { ...props } className = { `inline-flex min-h-10 shrink-0 items-center justify-center gap-2 rounded-lg border px-3 py-2 text-sm font-semibold transition disabled:cursor-not-allowed disabled:opacity-50 ${ buttonClasses [ variant ] } ${ className } ` } /> ;
7078}
0 commit comments