import React, { useState, useEffect } from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, AreaChart, Area } from 'recharts';
import {
Heart, Calendar, Pill, TestTube, MessageSquare, Bell, User, LogOut,
Clock, FileText, Download, Plus, ChevronRight, CheckCircle, AlertCircle,
Activity, Stethoscope, Mail, Shield, TrendingUp
} from 'lucide-react';
// Mock Data (since connections are pending credentials)
const mockAppointments = [
{ id: 'apt-001', date: '2026-01-18', time: '10:00 AM', provider: 'Dr. Chen', specialty: 'Primary Care', location: 'Main Clinic', type: 'Follow-up', status: 'confirmed' },
{ id: 'apt-002', date: '2026-02-02', time: '2:30 PM', provider: 'Lab Services', specialty: 'Diagnostics', location: 'Lab Wing', type: 'Blood Draw', status: 'pending' },
{ id: 'apt-003', date: '2026-02-15', time: '11:00 AM', provider: 'Dr. Patel', specialty: 'Endocrinology', location: 'Specialty Clinic', type: 'Consultation', status: 'confirmed' },
];
const mockPrescriptions = [
{ id: 'rx-001', medication: 'Metformin', dosage: '500mg', frequency: 'Twice daily', prescriber: 'Dr. Chen', refillsRemaining: 3, nextRefillDate: '2026-01-20', status: 'active', refillable: true },
{ id: 'rx-002', medication: 'Lisinopril', dosage: '10mg', frequency: 'Once daily', prescriber: 'Dr. Chen', refillsRemaining: 1, nextRefillDate: '2026-01-17', status: 'refill-needed', refillable: true },
{ id: 'rx-003', medication: 'Atorvastatin', dosage: '20mg', frequency: 'Once daily at bedtime', prescriber: 'Dr. Patel', refillsRemaining: 5, nextRefillDate: '2026-02-01', status: 'active', refillable: true },
];
const mockLabResults = [
{ id: 'lab-001', testName: 'HbA1c', date: '2025-12-15', value: '6.8', unit: '%', referenceRange: '4.0-5.6', status: 'borderline', category: 'Chemistry', trend: [6.5, 6.6, 6.7, 6.8, 6.8] },
{ id: 'lab-002', testName: 'Fasting Glucose', date: '2025-12-15', value: '112', unit: 'mg/dL', referenceRange: '70-100', status: 'borderline', category: 'Chemistry', trend: [105, 108, 110, 112, 112] },
{ id: 'lab-003', testName: 'Total Cholesterol', date: '2025-12-15', value: '195', unit: 'mg/dL', referenceRange: '<200', status: 'normal', category: 'Lipid Panel', trend: [210, 205, 198, 195, 195] },
{ id: 'lab-004', testName: 'LDL Cholesterol', date: '2025-12-15', value: '118', unit: 'mg/dL', referenceRange: '<100', status: 'borderline', category: 'Lipid Panel', trend: [130, 125, 120, 118, 118] },
{ id: 'lab-005', testName: 'HDL Cholesterol', date: '2025-12-15', value: '58', unit: 'mg/dL', referenceRange: '>40', status: 'normal', category: 'Lipid Panel', trend: [52, 54, 56, 57, 58] },
];
const mockMessages = [
{ id: 'msg-001', sender: 'Dr. Chen', subject: 'Lab Results Review', date: '2026-01-14', read: false, preview: 'Hi Sarah, I reviewed your recent lab results...' },
{ id: 'msg-002', sender: 'Billing Department', subject: 'Insurance Verification', date: '2026-01-12', read: true, preview: 'We have successfully verified your insurance...' },
{ id: 'msg-003', sender: 'Pharmacy Team', subject: 'Prescription Ready', date: '2026-01-10', read: true, preview: 'Your prescription refill is ready for pickup...' },
];
const mockTrendData = [
{ date: 'Aug', hba1c: 6.5, glucose: 105 },
{ date: 'Sep', hba1c: 6.6, glucose: 108 },
{ date: 'Oct', hba1c: 6.7, glucose: 110 },
{ date: 'Nov', hba1c: 6.8, glucose: 112 },
{ date: 'Dec', hba1c: 6.8, glucose: 112 },
];
export default function App() {
const [activeTab, setActiveTab] = useState('appointments');
const [selectedLab, setSelectedLab] = useState(null);
const [selectedAppointment, setSelectedAppointment] = useState(null);
const [selectedMessage, setSelectedMessage] = useState(null);
const [showRefillModal, setShowRefillModal] = useState(null);
const [calendarView, setCalendarView] = useState('month');
const [notifications, setNotifications] = useState(2);
// Get status badge color
const getStatusColor = (status) => {
switch (status) {
case 'normal': case 'confirmed': case 'active': return 'bg-emerald-500/10 text-emerald-400 border-emerald-500/20';
case 'borderline': case 'pending': case 'refill-needed': return 'bg-amber-500/10 text-amber-400 border-amber-500/20';
case 'abnormal': case 'critical': return 'bg-red-500/10 text-red-400 border-red-500/20';
default: return 'bg-slate-500/10 text-slate-400 border-slate-500/20';
}
};
const getStatusIcon = (status) => {
switch (status) {
case 'normal': case 'confirmed': case 'active': return
Healthcare Dashboard
Sarah Johnson
Patient
Here's your health overview for today
Monday, January 15, 2026
{nextAppointment.date.split('-')[1]}/{nextAppointment.date.split('-')[2]}
{nextAppointment.time}
{nextAppointment.provider}
{medsDueThisWeek.length}
due this week
{medsDueThisWeek.length > 0 && ({medsDueThisWeek[0].medication}
)}{pendingLabs.length}
need attention
{pendingLabs.length > 0 && (Ready to review
)}{unreadMessages.length}
unread
{unreadMessages.length > 0 && (From: {unreadMessages[0].sender}
)}{apt.specialty} • {apt.type}
{apt.time} • {apt.location}
| Medication | Dosage | Frequency | Next Refill | Status | Action |
|---|---|---|---|---|---|
|
{rx.medication} {rx.prescriber} |
{rx.dosage} | {rx.frequency} | {rx.nextRefillDate} | {getStatusIcon(rx.status)} {rx.status.replace('-', ' ')} | {rx.refillable && ( )} |
{lab.date} • {lab.category}
{lab.value} {lab.unit}
Ref: {lab.referenceRange}
{msg.subject}
{msg.preview}
{record.count} records
{selectedLab.date} • {selectedLab.category}
Result Value
{selectedLab.value} {selectedLab.unit}
Reference Range
{selectedLab.referenceRange}
{selectedLab.status === 'normal' ? `Your ${selectedLab.testName} level is within the normal range. Continue following your current health plan.` : selectedLab.status === 'borderline' ? `Your ${selectedLab.testName} level is slightly elevated. Consider discussing lifestyle modifications with your healthcare provider.` : `Your ${selectedLab.testName} level is outside the normal range. Please schedule a follow-up appointment with your doctor.` }
{selectedAppointment.date} at {selectedAppointment.time}
Provider
{selectedAppointment.provider}
{selectedAppointment.specialty}
Date & Time
{selectedAppointment.date} at {selectedAppointment.time}
Location
{selectedAppointment.location}
From: {selectedMessage.sender} • {selectedMessage.date}
{selectedMessage.preview}
Please review your recent lab results and let me know if you have any questions. I recommend scheduling a follow-up appointment to discuss the borderline HbA1c levels.
Best regards,
Dr. Chen
Medication
{showRefillModal.medication} ({showRefillModal.dosage})
Current Refills Remaining
{showRefillModal.refillsRemaining}
Pharmacy
CVS Pharmacy #1234
✓ This medication is eligible for refill. Your request will be sent to {showRefillModal.prescriber} for approval.