Skip to content

Commit 7917024

Browse files
committed
catch erro
1 parent d9bc76d commit 7917024

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

LongevityWorldCup.Website/wwwroot/onboarding/pheno-age.html

+23-3
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,15 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">
374374
</form>
375375

376376
<div id="phenoAgeResult" class="bioageform" data-aos="fade" data-aos-duration="700" data-aos-delay="400">
377-
<div style="font-size: 1rem; color: #2c3e50; text-align: center;">Your biological age is:</div>
378-
<div style="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center;"><span id="animatedAge">0</span></div>
379-
<div id="yearsText" style="font-size: 1rem; color: #2c3e50; text-align: center;">years</div>
377+
<div id="validAgeInput">
378+
<div style="font-size: 1rem; color: #2c3e50; text-align: center;">Your biological age is:</div>
379+
<div style="font-size: 2.5rem; color: #4CAF50; font-weight: bold; text-align: center;"><span id="animatedAge">0</span></div>
380+
<div id="yearsText" style="font-size: 1rem; color: #2c3e50; text-align: center;">years</div>
381+
</div>
382+
<div id="ensureCorrectInputSuggestion" style="display: none; font-size: 1rem; color: #8B0000; background-color: #FAD2D2; padding: 0.5rem; text-align: center; border-radius: 5px; margin-top: 10px;">
383+
The calculated result seems wrong. Double-check all your input values and units. If everything looks correct, drop everything and rush to a hospital NOW!!!
384+
<i class="fas fa-ambulance"></i> <i class="fas fa-hospital"></i> <i class="fas fa-clinic-medical"></i>
385+
</div>
380386
</div>
381387

382388
<div class="options-container" data-aos="fade" data-aos-duration="700" data-aos-delay="400">
@@ -540,6 +546,20 @@ <h2 data-aos="fade" data-aos-duration="700" data-aos-delay="250">
540546

541547
// Display the result
542548
const resultElement = document.getElementById('phenoAgeResult');
549+
const ensureCorrectInputSuggestion = document.getElementById('ensureCorrectInputSuggestion');
550+
const validAgeInput = document.getElementById('validAgeInput');
551+
552+
// Check if the result is not infinite
553+
if (!isFinite(phenoAge)) {
554+
resultElement.style.opacity = 1; // Fade-in effect
555+
ensureCorrectInputSuggestion.style.display = 'block';
556+
validAgeInput.style.display = 'none';
557+
return;
558+
}
559+
else {
560+
ensureCorrectInputSuggestion.style.display = 'none';
561+
validAgeInput.style.display = 'block';
562+
}
543563

544564
// Setting up the animated counter effect
545565
let displayAge = 0;

0 commit comments

Comments
 (0)