diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx index 48af52f..0577588 100644 --- a/frontend/src/pages/Dashboard.tsx +++ b/frontend/src/pages/Dashboard.tsx @@ -15,28 +15,28 @@ const Dashboard = () => { title: "Last Night's Sleep", date: "April 25, 2025", duration: 7.2, - quality: 82, + AHI: 99, }, { id: "rec2", title: "Nap After Work", date: "April 24, 2025", duration: 1.5, - quality: 68, + AHI: 82, }, { id: "rec3", - title: "Night with Storm", + title: "Night with CPAP", date: "April 23, 2025", duration: 6.8, - quality: 62, + AHI: 14, }, { id: "rec4", title: "Regular Night", date: "April 22, 2025", duration: 8.1, - quality: 91, + AHI: 68, }, ]; @@ -51,15 +51,20 @@ const Dashboard = () => { { time: "Apr 25", value: 82 }, ]; - const sleepDurationData = [ - { time: "Apr 19", value: 6.9 }, - { time: "Apr 20", value: 7.5 }, - { time: "Apr 21", value: 7.8 }, - { time: "Apr 22", value: 8.1 }, - { time: "Apr 23", value: 6.8 }, - { time: "Apr 24", value: 1.5 }, - { time: "Apr 25", value: 7.2 }, - ]; + // Data at a Glance for the most recent data + const snoringEvents = 71; + const breathEvents = 421; + const totalEvents = snoringEvents + breathEvents; + const duration = 4.97; + const eventsPerHour = (totalEvents / duration).toFixed(1); + const getAHISeverity = (eventsPerHour) => { + const eph = parseFloat(eventsPerHour); + if (eph < 5) return "Normal"; + if (eph < 15) return "Mild"; + if (eph < 30) return "Moderate"; + return "Severe"; + }; + const severity = getAHISeverity(eventsPerHour); return (
@@ -89,15 +94,33 @@ const Dashboard = () => { {/* Charts Section */}
- + {/* Data at a Glance Card */} +
+

Data at a Glance

+
+
+
Snoring Events
+
{snoringEvents}
+
+
+
Obstructed Breath Events
+
{breathEvents}
+
+
+
Events/Hour
+
{eventsPerHour}
+
+
+
AHI
+
{severity}
+
+
+
{/* Recordings Section */} @@ -113,7 +136,7 @@ const Dashboard = () => { title={recording.title} date={recording.date} duration={recording.duration} - quality={recording.quality} + AHI={recording.AHI} /> ))}