Skip to content

Commit 9319af0

Browse files
committed
Fix: Scientific warnings remove choices if you chose to remove them.
1 parent 092a0ef commit 9319af0

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

src/components/OrbitSystem.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,10 @@ export default function OrbitSystem() {
353353
<ScientificWarningModal
354354
alien={pendingMatchAlien}
355355
onProceed={() => confirmMatch(pendingMatchAlien)}
356-
onCancel={() => setPendingMatchAlien(null)}
356+
onCancel={() => {
357+
handleDismiss(pendingMatchAlien);
358+
setPendingMatchAlien(null);
359+
}}
357360
/>
358361
)}
359362

src/components/ProfileModal.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)