diff --git a/components/bed-pressure/AlertsPanel.tsx b/components/bed-pressure/AlertsPanel.tsx index 6f785b4..d9c7f8f 100644 --- a/components/bed-pressure/AlertsPanel.tsx +++ b/components/bed-pressure/AlertsPanel.tsx @@ -47,8 +47,16 @@ export function AlertsPanel() { if (silenced) return "bg-gray-100 border-gray-300" return type === 'alarm' ? "bg-red-50 border-red-200" : "bg-yellow-50 border-yellow-200" } + // Filter out warnings when there's an alarm with the same sensor name + const filteredAlarms = activeAlarms.filter(alarm => { + if (alarm.type === 'alarm') return true + // For warnings, only keep if there's no alarm with the same sensor name + return !activeAlarms.some(other => + other.type === 'alarm' && other.sensorLabel === alarm.sensorLabel + ) + }) - const hasActiveAlarms = activeAlarms.some(alarm => !alarm.silenced) + const hasActiveAlarms = filteredAlarms.some(alarm => !alarm.silenced) return ( @@ -56,7 +64,7 @@ export function AlertsPanel() {
- Active Alarms ({activeAlarms.length}) + Active Alarms ({filteredAlarms.length}) {activeAlarms.length > 0 && (
- - +
- {activeAlarms.length === 0 ? ( + {filteredAlarms.length === 0 ? (

No active alarms

System monitoring normally

) : ( - activeAlarms.map((alarm) => ( + filteredAlarms.map((alarm) => (