import React, { useState, useEffect } from 'react';
import { Activity, AlertCircle, Clock, Users, Bell, Heart, Thermometer, Wind, CheckCircle, UserX } from 'lucide-react';
const StaffDashboard = () => {
const [patients, setPatients] = useState([]);
const [stats, setStats] = useState({
total_patients: 0,
active_patients: 0,
tier_breakdown: { EMERGENCY: 0, ALERT: 0, NORMAL: 0 },
average_wait_minutes: 0
});
const [selectedPatient, setSelectedPatient] = useState(null);
const [filter, setFilter] = useState('all');
useEffect(() => {
const generateMockPatients = () => {
const mockPatients = [
{
patient_id: 'P100001',
band_id: 'VitalLink-A1B2',
name: 'John Smith',
tier: 'NORMAL',
priority_score: 15.2,
wait_time_minutes: 22,
last_hr: 76,
last_spo2: 98,
last_temp: 36.8,
symptoms: ['Chest Pain', 'Nausea']
},
{
patient_id: 'P100002',
band_id: 'VitalLink-C3D4',
name: 'Sarah Johnson',
tier: 'ALERT',
priority_score: 68.5,
wait_time_minutes: 45,
last_hr: 118,
last_spo2: 93,
last_temp: 38.4,
symptoms: ['Fever', 'Difficulty Breathing']
},
{
patient_id: 'P100003',
band_id: 'VitalLink-E5F6',
name: 'Michael Chen',
tier: 'EMERGENCY',
priority_score: 142.8,
wait_time_minutes: 8,
last_hr: 148,
last_spo2: 86,
last_temp: 39.7,
symptoms: ['Severe Headache', 'Chest Pain']
},
{
patient_id: 'P100004',
band_id: 'VitalLink-G7H8',
name: 'Emily Davis',
tier: 'NORMAL',
priority_score: 18.0,
wait_time_minutes: 35,
last_hr: 82,
last_spo2: 97,
last_temp: 37.1,
symptoms: ['Abdominal Pain']
},
{
patient_id: 'P100005',
band_id: 'VitalLink-I9J0',
name: 'Robert Williams',
tier: 'ALERT',
priority_score: 72.3,
wait_time_minutes: 52,
last_hr: 124,
last_spo2: 91,
last_temp: 38.8,
symptoms: ['Fever', 'Dizziness']
}
];
setPatients(mockPatients);
setStats({
total_patients: 5,
active_patients: 5,
tier_breakdown: { EMERGENCY: 1, ALERT: 2, NORMAL: 2 },
average_wait_minutes: 32.4
});
};
generateMockPatients();
const interval = setInterval(() => {
setPatients(prev => prev.map(p => ({
...p,
wait_time_minutes: p.wait_time_minutes + 1,
last_hr: Math.max(40, Math.min(180, p.last_hr + Math.floor(Math.random() * 5) - 2)),
last_spo2: Math.max(70, Math.min(100, p.last_spo2 + Math.floor(Math.random() * 3) - 1)),
last_temp: Math.max(35, Math.min(41, p.last_temp + (Math.random() * 0.2 - 0.1)))
})));
}, 3000);
return () => clearInterval(interval);
}, []);
const getTierColor = (tier) => {
switch(tier) {
case 'EMERGENCY': return 'bg-red-100 text-red-800 border-red-300';
case 'ALERT': return 'bg-yellow-100 text-yellow-800 border-yellow-300';
case 'NORMAL': return 'bg-green-100 text-green-800 border-green-300';
default: return 'bg-gray-100 text-gray-800 border-gray-300';
}
};
const getTierIcon = (tier) => {
switch(tier) {
case 'EMERGENCY': return
Emergency Department Patient Monitoring
Last Update
{new Date().toLocaleTimeString()}
Active Patients
{stats.active_patients}
Emergency
{stats.tier_breakdown.EMERGENCY}
Alert
{stats.tier_breakdown.ALERT}
Avg Wait Time
{stats.average_wait_minutes} min
{patient.last_hr}
bpm
{patient.last_spo2}
%
{patient.last_temp.toFixed(1)}
°C
{patient.wait_time_minutes}
minutes
Patients will appear here as they check in