);
diff --git a/src/pages/home/Home.tsx b/src/pages/home/Home.tsx
index b1d6779..8db58df 100644
--- a/src/pages/home/Home.tsx
+++ b/src/pages/home/Home.tsx
@@ -1,7 +1,16 @@
+import { useEffect } from 'react';
import { Link } from 'react-router';
+import { useAppContext } from '../../context/AppContext';
import styles from "./Home.module.css";
function Home() {
+ const { clearPreferences } = useAppContext();
+
+ // Reset all user data when returning to the home page
+ useEffect(() => {
+ clearPreferences();
+ }, []);
+
return (

diff --git a/src/utils/compatibility.ts b/src/utils/compatibility.ts
new file mode 100644
index 0000000..567624a
--- /dev/null
+++ b/src/utils/compatibility.ts
@@ -0,0 +1,55 @@
+import type { AlienProfile } from '../data/mockAliens';
+import type { UserPreferences } from '../context/AppContext';
+
+// Size proximity
+const sizeOrder = ['Small', 'Medium', 'Large', 'Colossal'];
+
+// Type proximity
+const typeOrder = ['Human', 'Hybrid', 'Alien'];
+
+export function getCompatibility(alien: AlienProfile, prefs: UserPreferences | null): number {
+ if (!prefs) return 50.0;
+
+ let score = 40; // Base score
+
+ // Size Match (max 25)
+ if (prefs.size === alien.size) {
+ score += 25;
+ } else if (prefs.size === 'No preference' || !prefs.size) {
+ score += 20;
+ } else {
+ const userSizeIdx = sizeOrder.indexOf(prefs.size);
+ const alienSizeIdx = sizeOrder.indexOf(alien.size);
+ if (userSizeIdx !== -1 && alienSizeIdx !== -1) {
+ const diff = Math.abs(userSizeIdx - alienSizeIdx);
+ if (diff === 1) score += 15; // Close
+ else if (diff === 2) score += 5; // Farther
+ // diff of 3 is 0 points
+ }
+ }
+
+ // Type Match (max 25)
+ if (prefs.alienType === 'Open to all' || !prefs.alienType) {
+ score += 20;
+ } else if (prefs.alienType === alien.alienType) {
+ score += 25;
+ } else {
+ const userTypeIdx = typeOrder.indexOf(prefs.alienType);
+ const alienTypeIdx = typeOrder.indexOf(alien.alienType);
+ if (userTypeIdx !== -1 && alienTypeIdx !== -1) {
+ const diff = Math.abs(userTypeIdx - alienTypeIdx);
+ if (diff === 1) score += 15; // Human -> Hybrid, or Hybrid -> Alien
+ }
+ }
+
+ // Distance Match (max 10)
+ if (prefs.maxDistanceLY > 0) {
+ const distanceScore = Math.max(0, 1 - (alien.distanceLY / prefs.maxDistanceLY));
+ score += distanceScore * 10;
+ } else {
+ score += 5;
+ }
+
+ // Cap between 10.0 and 99.9
+ return Math.min(99.9, Math.max(10.0, Math.round(score * 10) / 10));
+}
diff --git a/src/utils/scienceWarnings.ts b/src/utils/scienceWarnings.ts
new file mode 100644
index 0000000..be0e99b
--- /dev/null
+++ b/src/utils/scienceWarnings.ts
@@ -0,0 +1,168 @@
+import type { AlienProfile } from '../data/mockAliens';
+
+export interface ScientificWarning {
+ label: string;
+ alienValue: string;
+ earthValue: string;
+ severity: 'danger' | 'warning'; // danger = lethal/extreme, warning = uncomfortable
+ description: string;
+}
+
+// Earth baseline values
+const EARTH_GRAVITY = 1.0;
+const EARTH_OXYGEN = 21;
+const EARTH_TEMP_C = 15;
+const EARTH_PLANET = 'Solid Ground';
+
+export function getScientificWarnings(alien: AlienProfile): ScientificWarning[] {
+ const warnings: ScientificWarning[] = [];
+
+ // --- Gravity ---
+ const gravDiff = alien.gravityGs - EARTH_GRAVITY;
+ if (alien.gravityGs > 3.0) {
+ warnings.push({
+ label: 'Extreme Gravity',
+ alienValue: `${alien.gravityGs}G`,
+ earthValue: `${EARTH_GRAVITY}G`,
+ severity: 'danger',
+ description: `Gravity is ${alien.gravityGs}x Earth's. Your bones and organs would be crushed under the pressure.`,
+ });
+ } else if (alien.gravityGs > 1.8) {
+ warnings.push({
+ label: 'High Gravity',
+ alienValue: `${alien.gravityGs}G`,
+ earthValue: `${EARTH_GRAVITY}G`,
+ severity: 'warning',
+ description: `Gravity is ${alien.gravityGs}x Earth's. You would experience severe joint and cardiovascular strain.`,
+ });
+ } else if (alien.gravityGs < 0.3) {
+ warnings.push({
+ label: 'Near-Zero Gravity',
+ alienValue: `${alien.gravityGs}G`,
+ earthValue: `${EARTH_GRAVITY}G`,
+ severity: 'danger',
+ description: `Gravity is only ${alien.gravityGs}x Earth's. Long-term exposure causes fatal bone density and muscle loss.`,
+ });
+ } else if (alien.gravityGs < 0.6) {
+ warnings.push({
+ label: 'Low Gravity',
+ alienValue: `${alien.gravityGs}G`,
+ earthValue: `${EARTH_GRAVITY}G`,
+ severity: 'warning',
+ description: `Gravity is only ${alien.gravityGs}x Earth's. Extended stays cause bone density loss and circulation issues.`,
+ });
+ }
+ // suppress unused var warning
+ void gravDiff;
+
+ // --- Oxygen ---
+ if (alien.oxygenPercent === 0) {
+ warnings.push({
+ label: 'No Oxygen',
+ alienValue: `${alien.oxygenPercent}%`,
+ earthValue: `${EARTH_OXYGEN}%`,
+ severity: 'danger',
+ description: 'There is no breathable oxygen. You would need a full life-support suit at all times.',
+ });
+ } else if (alien.oxygenPercent < 10) {
+ warnings.push({
+ label: 'Critically Low Oxygen',
+ alienValue: `${alien.oxygenPercent}%`,
+ earthValue: `${EARTH_OXYGEN}%`,
+ severity: 'danger',
+ description: `Atmospheric oxygen is only ${alien.oxygenPercent}% — far below survivable levels. Hypoxia would be near-instant.`,
+ });
+ } else if (alien.oxygenPercent < 17) {
+ warnings.push({
+ label: 'Low Oxygen',
+ alienValue: `${alien.oxygenPercent}%`,
+ earthValue: `${EARTH_OXYGEN}%`,
+ severity: 'warning',
+ description: `Atmospheric oxygen is ${alien.oxygenPercent}%. You would experience dizziness, fatigue, and shortness of breath.`,
+ });
+ } else if (alien.oxygenPercent > 30) {
+ warnings.push({
+ label: 'Hyperoxic Atmosphere',
+ alienValue: `${alien.oxygenPercent}%`,
+ earthValue: `${EARTH_OXYGEN}%`,
+ severity: 'warning',
+ description: `Atmospheric oxygen is ${alien.oxygenPercent}%. This hyperoxic environment risks oxygen toxicity and extreme fire hazard.`,
+ });
+ }
+
+ // --- Temperature ---
+ const tempDiff = alien.homeTemperatureC - EARTH_TEMP_C;
+ void tempDiff;
+ if (alien.homeTemperatureC > 1000) {
+ warnings.push({
+ label: 'Lethal Heat',
+ alienValue: `${alien.homeTemperatureC.toLocaleString()}°C`,
+ earthValue: `${EARTH_TEMP_C}°C`,
+ severity: 'danger',
+ description: `Surface temperature is ${alien.homeTemperatureC.toLocaleString()}°C. You would vaporise instantly without extreme shielding.`,
+ });
+ } else if (alien.homeTemperatureC > 60) {
+ warnings.push({
+ label: 'Extreme Heat',
+ alienValue: `${alien.homeTemperatureC}°C`,
+ earthValue: `${EARTH_TEMP_C}°C`,
+ severity: 'danger',
+ description: `Surface temperature is ${alien.homeTemperatureC}°C. This is above the threshold for human protein denaturation.`,
+ });
+ } else if (alien.homeTemperatureC > 40) {
+ warnings.push({
+ label: 'Very Hot Environment',
+ alienValue: `${alien.homeTemperatureC}°C`,
+ earthValue: `${EARTH_TEMP_C}°C`,
+ severity: 'warning',
+ description: `Surface temperature is ${alien.homeTemperatureC}°C. Risk of dangerous overheating and severe dehydration.`,
+ });
+ } else if (alien.homeTemperatureC < -150) {
+ warnings.push({
+ label: 'Lethal Cold',
+ alienValue: `${alien.homeTemperatureC}°C`,
+ earthValue: `${EARTH_TEMP_C}°C`,
+ severity: 'danger',
+ description: `Surface temperature is ${alien.homeTemperatureC}°C. Exposed tissue freezes in milliseconds. Survival is impossible unprotected.`,
+ });
+ } else if (alien.homeTemperatureC < -40) {
+ warnings.push({
+ label: 'Extreme Cold',
+ alienValue: `${alien.homeTemperatureC}°C`,
+ earthValue: `${EARTH_TEMP_C}°C`,
+ severity: 'danger',
+ description: `Surface temperature is ${alien.homeTemperatureC}°C. Severe frostbite and hypothermia would set in almost immediately.`,
+ });
+ } else if (alien.homeTemperatureC < -10) {
+ warnings.push({
+ label: 'Very Cold Environment',
+ alienValue: `${alien.homeTemperatureC}°C`,
+ earthValue: `${EARTH_TEMP_C}°C`,
+ severity: 'warning',
+ description: `Surface temperature is ${alien.homeTemperatureC}°C. You would require heavy cold-weather gear at all times.`,
+ });
+ }
+
+ // --- Planet Type ---
+ if (alien.planetType !== EARTH_PLANET) {
+ if (alien.planetType === 'Gas Giant') {
+ warnings.push({
+ label: 'No Solid Surface',
+ alienValue: 'Gas Giant',
+ earthValue: 'Solid Ground',
+ severity: 'danger',
+ description: 'There is no solid surface. You would fall through perpetual crushing gas layers with no way to land.',
+ });
+ } else if (alien.planetType === 'All Water') {
+ warnings.push({
+ label: 'Ocean World',
+ alienValue: 'All Water',
+ earthValue: 'Solid Ground',
+ severity: 'warning',
+ description: 'The planet is entirely ocean. You would need full aquatic life support to survive on the surface.',
+ });
+ }
+ }
+
+ return warnings;
+}
diff --git a/update_aliens.js b/update_aliens.js
new file mode 100644
index 0000000..d31c322
--- /dev/null
+++ b/update_aliens.js
@@ -0,0 +1,25 @@
+const fs = require('fs');
+let content = fs.readFileSync('src/data/mockAliens.ts', 'utf8');
+
+const types = {
+ "Glaxion": "Alien",
+ "Zorblax": "Alien",
+ "Vex'tar": "Alien",
+ "Crystalia": "Alien",
+ "Spore'rel": "Alien",
+ "Lyra": "Alien",
+ "Lumina": "Hybrid",
+ "Zarok": "Hybrid",
+ "Squish": "Alien",
+ "Xeno": "Alien",
+ "Cyra": "Hybrid",
+ "Ignis": "Human",
+ "Sparky": "Alien",
+ "Kaelen": "Human"
+};
+
+for (const [name, type] of Object.entries(types)) {
+ const regex = new RegExp(`name: "${name}",\\s*alienType: "[^"]+"`, 'g');
+ content = content.replace(regex, `name: "${name}",\n alienType: "${type}"`);
+}
+fs.writeFileSync('src/data/mockAliens.ts', content);