@@ -19,12 +19,22 @@ export default function ProfileModal({ alien, onClose, onMatch, onDismiss }: Pro
1919 const warnings = getScientificWarnings ( alien ) ;
2020 const warnedLabels = new Set ( warnings . map ( w => w . label . toLowerCase ( ) ) ) ;
2121
22- // Helper: return red/orange border colour if a stat is flagged
22+ // Helper: return red/orange border colour if a stat is flagged by keyword match
2323 const dangerFor = ( key : string ) => {
2424 const w = warnings . find ( w => w . label . toLowerCase ( ) . includes ( key . toLowerCase ( ) ) ) ;
2525 if ( ! w ) return 'rgba(234, 222, 218, 0.1)' ;
2626 return w . severity === 'danger' ? 'rgba(220, 38, 38, 0.6)' : 'rgba(245, 158, 11, 0.6)' ;
2727 } ;
28+
29+ // Dedicated temperature check — catches all heat/cold warning labels
30+ const dangerForTemp = ( ) => {
31+ const tempKeywords = [ 'heat' , 'hot' , 'cold' , 'temperature' ] ;
32+ const w = warnings . find ( w =>
33+ tempKeywords . some ( k => w . label . toLowerCase ( ) . includes ( k ) )
34+ ) ;
35+ if ( ! w ) return 'rgba(234, 222, 218, 0.1)' ;
36+ return w . severity === 'danger' ? 'rgba(220, 38, 38, 0.6)' : 'rgba(245, 158, 11, 0.6)' ;
37+ } ;
2838 void warnedLabels ;
2939
3040 useEffect ( ( ) => {
@@ -175,7 +185,7 @@ export default function ProfileModal({ alien, onClose, onMatch, onDismiss }: Pro
175185 < div style = { { fontSize : '1.5rem' , fontWeight : 'bold' , color : 'var(--color-primary)' } } > { alien . oxygenPercent } %</ div >
176186 < div style = { { fontSize : '0.8rem' , opacity : 0.8 } } > Atmospheric Oxygen</ div >
177187 </ div >
178- < div className = "glass-panel" style = { { padding : '16px' , textAlign : 'center' , border : `1px solid ${ dangerFor ( 'temperature' ) || dangerFor ( 'heat' ) || dangerFor ( 'cold' ) } ` } } >
188+ < div className = "glass-panel" style = { { padding : '16px' , textAlign : 'center' , border : `1px solid ${ dangerForTemp ( ) } ` } } >
179189 < div style = { { fontSize : '1.5rem' , fontWeight : 'bold' , color : 'var(--color-primary)' , display : 'flex' , alignItems : 'center' , justifyContent : 'center' , gap : '6px' } } >
180190 < Thermometer size = { 20 } /> { alien . homeTemperatureC . toLocaleString ( ) } °C
181191 </ div >
0 commit comments