-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathMaintenanceAlertPanel.jsx
More file actions
42 lines (39 loc) · 1.38 KB
/
MaintenanceAlertPanel.jsx
File metadata and controls
42 lines (39 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { URGENCY_STYLES } from './constants';
import styles from './UtilizationChart.module.css';
function MaintenanceAlertPanel({ alerts }) {
const sortedAlerts = [...alerts].sort((a, b) =>
a.urgency === 'high' && b.urgency !== 'high' ? -1 : 1,
);
return (
<section className={styles.insightsPanel} aria-labelledby="maintenance-heading">
<h3 id="maintenance-heading" className={styles.panelTitle}>
Maintenance Alerts
</h3>
{sortedAlerts.length === 0 ? (
<p className={styles.emptyPanel}>No maintenance alerts.</p>
) : (
<ul className={styles.alertList}>
{sortedAlerts.map((alert, index) => (
<li
key={`${alert.toolName}-${alert.alertType}-${index}`}
className={styles.alertItem}
data-urgency={alert.urgency}
>
<div className={styles.alertHeader}>
<span
className={styles.urgencyBadge}
style={{ backgroundColor: URGENCY_STYLES[alert.urgency]?.color }}
>
{URGENCY_STYLES[alert.urgency]?.label}
</span>
<strong>{alert.toolName}</strong>
</div>
<p className={styles.alertMessage}>{alert.message}</p>
</li>
))}
</ul>
)}
</section>
);
}
export default MaintenanceAlertPanel;