@@ -24,17 +24,28 @@ const formatInsertedAt = (insertedAt) => {
2424
2525const isSuccess = ( item ) => item ?. status === "success" ;
2626
27- const buildRunMeta = ( item ) => {
28- if ( ! item || typeof item !== "object" ) {
29- return item ? String ( item ) : null ;
27+ const findBestRunId = ( items ) => {
28+ if ( ! items || items . length === 0 ) {
29+ return null ;
3030 }
3131
32- return [ i18n . t ( "Score %{score}" , { score : item . score ?? 0 } ) , formatInsertedAt ( item . insertedAt ) ]
33- . filter ( Boolean )
34- . join ( " · " ) ;
32+ let bestId = null ;
33+ let bestScore = - Infinity ;
34+
35+ items . forEach ( ( item ) => {
36+ const score = item ?. score ?? 0 ;
37+ if ( score > bestScore ) {
38+ bestScore = score ;
39+ bestId = item ?. id ;
40+ }
41+ } ) ;
42+
43+ return bestId ;
3544} ;
3645
3746function EvolutionPanel ( { items, tournamentStatus, runId, setRunId, repoUrl } ) {
47+ const bestRunId = findBestRunId ( items ) ;
48+
3849 return (
3950 < div className = "card cb-card border cb-border-color rounded shadow-sm" >
4051 < div className = "card-header py-2 border-bottom cb-border-color" >
@@ -63,9 +74,17 @@ function EvolutionPanel({ items, tournamentStatus, runId, setRunId, repoUrl }) {
6374 { items . map ( ( item , idx ) => {
6475 const isActive = runId === item ?. id ;
6576 const success = isSuccess ( item ) ;
66- const borderColor = success ? "rgba(40, 167, 69, 0.95)" : "rgba(220, 53, 69, 0.95)" ;
67- const meta = buildRunMeta ( item ) ;
77+ const isBest = item ?. id != null && item . id === bestRunId ;
78+ const statusColor = success ? "rgba(40, 167, 69, 0.95)" : "rgba(220, 53, 69, 0.95)" ;
79+ const goldColor = "rgba(255, 193, 7, 0.95)" ;
80+ const ringColor = isBest
81+ ? goldColor
82+ : isActive
83+ ? "rgba(96, 165, 250, 0.95)"
84+ : "rgba(99, 102, 121, 0.95)" ;
6885 const title = `v${ items . length - idx } ` ;
86+ const score = item ?. score ?? 0 ;
87+ const time = formatInsertedAt ( item ?. insertedAt ) ;
6988
7089 return (
7190 < button
@@ -74,18 +93,16 @@ function EvolutionPanel({ items, tournamentStatus, runId, setRunId, repoUrl }) {
7493 onClick = { ( ) => setRunId ( item ?. id ) }
7594 className = "rounded p-2 text-left bg-transparent mb-2"
7695 style = { {
77- borderTop : isActive
78- ? "1px solid rgba(96, 165, 250, 0.95)"
79- : "1px solid rgba(99, 102, 121, 0.95)" ,
80- borderRight : isActive
81- ? "1px solid rgba(96, 165, 250, 0.95)"
82- : "1px solid rgba(99, 102, 121, 0.95)" ,
83- borderBottom : isActive
84- ? "1px solid rgba(96, 165, 250, 0.95)"
85- : "1px solid rgba(99, 102, 121, 0.95)" ,
86- borderLeft : `3px solid ${ borderColor } ` ,
96+ borderTop : `${ isBest ? 2 : 1 } px solid ${ ringColor } ` ,
97+ borderRight : `${ isBest ? 2 : 1 } px solid ${ ringColor } ` ,
98+ borderBottom : `${ isBest ? 2 : 1 } px solid ${ ringColor } ` ,
99+ borderLeft : `3px solid ${ statusColor } ` ,
87100 backgroundColor : isActive ? "rgba(96, 165, 250, 0.25)" : "transparent" ,
88- boxShadow : isActive ? "0 0 0 1px rgba(96, 165, 250, 0.5)" : "none" ,
101+ boxShadow : isBest
102+ ? "0 0 0 1px rgba(255, 193, 7, 0.5)"
103+ : isActive
104+ ? "0 0 0 1px rgba(96, 165, 250, 0.5)"
105+ : "none" ,
89106 transition : "background-color 160ms ease, box-shadow 160ms ease" ,
90107 width : "100%" ,
91108 } }
@@ -102,9 +119,22 @@ function EvolutionPanel({ items, tournamentStatus, runId, setRunId, repoUrl }) {
102119 >
103120 < div className = "d-flex align-items-center text-nowrap" >
104121 < span className = "badge badge-secondary mr-2" > { title } </ span >
105- < span className = { `text-truncate ${ isActive ? "text-white" : "text-muted" } ` } >
106- { meta }
122+ < span
123+ className = "font-weight-bold mr-2"
124+ style = { {
125+ fontSize : "1.15rem" ,
126+ color : isBest ? goldColor : isActive ? "#ffffff" : "#e2e8f0" ,
127+ } }
128+ >
129+ { i18n . t ( "Score %{score}" , { score } ) }
107130 </ span >
131+ { time && (
132+ < span
133+ className = { `small text-truncate ${ isActive ? "text-white-50" : "text-muted" } ` }
134+ >
135+ { time }
136+ </ span >
137+ ) }
108138 </ div >
109139 </ button >
110140 ) ;
0 commit comments