@@ -24,14 +24,15 @@ function toSafeString(value: unknown): string {
2424 if ( Array . isArray ( value ) ) {
2525 return value . map ( ( v ) => {
2626 if ( v != null && typeof v === 'object' ) {
27- return ( v as any ) . name || ( v as any ) . label || ( v as any ) . _id || JSON . stringify ( v ) ;
27+ const obj = v as Record < string , unknown > ;
28+ return obj . name || obj . label || obj . _id || '[Object]' ;
2829 }
2930 return String ( v ) ;
3031 } ) . join ( ', ' ) ;
3132 }
3233 if ( typeof value === 'object' ) {
33- const obj = value as Record < string , any > ;
34- return obj . name || obj . label || obj . _id || JSON . stringify ( value ) ;
34+ const obj = value as Record < string , unknown > ;
35+ return String ( obj . name || obj . label || obj . _id || '[Object]' ) ;
3536 }
3637 return String ( value ) ;
3738}
@@ -62,6 +63,19 @@ const SEMANTIC_COLOR_MAP: Record<string, string> = {
6263 failed : 'bg-red-100 text-red-800 border-red-300' ,
6364} ;
6465
66+ /** Map named colors to full Tailwind class strings (JIT-safe, no template interpolation) */
67+ const COLOR_CLASS_MAP : Record < string , string > = {
68+ gray : 'bg-gray-100 text-gray-800 border-gray-300' ,
69+ red : 'bg-red-100 text-red-800 border-red-300' ,
70+ orange : 'bg-orange-100 text-orange-800 border-orange-300' ,
71+ yellow : 'bg-yellow-100 text-yellow-800 border-yellow-300' ,
72+ green : 'bg-green-100 text-green-800 border-green-300' ,
73+ blue : 'bg-blue-100 text-blue-800 border-blue-300' ,
74+ indigo : 'bg-indigo-100 text-indigo-800 border-indigo-300' ,
75+ purple : 'bg-purple-100 text-purple-800 border-purple-300' ,
76+ pink : 'bg-pink-100 text-pink-800 border-pink-300' ,
77+ } ;
78+
6579function getSemanticBadgeClasses ( val : string ) : string {
6680 const key = val . toLowerCase ( ) . replace ( / [ \s - ] / g, '_' ) ;
6781 return SEMANTIC_COLOR_MAP [ key ] || 'bg-muted text-muted-foreground border-border' ;
@@ -154,7 +168,7 @@ export const HeaderHighlight: React.FC<HeaderHighlightProps> = ({
154168 const option = options . find ( ( opt ) => String ( opt . value ) === strVal ) ;
155169 const label = option ?. label || humanizeLabel ( strVal ) ;
156170 const colorClasses = option ?. color
157- ? `bg- ${ option . color } -100 text-${ option . color } -800 border-${ option . color } -300`
171+ ? ( COLOR_CLASS_MAP [ option . color ] || 'bg-muted text-muted-foreground border-border' )
158172 : getSemanticBadgeClasses ( strVal ) ;
159173 displayNode = (
160174 < Badge variant = "outline" className = { colorClasses } >
0 commit comments