diff --git a/public/index.html b/public/index.html
index 244d110..115b087 100644
--- a/public/index.html
+++ b/public/index.html
@@ -463,8 +463,10 @@
let html = '';
// Limit display to fit on TV screen without scrolling
- const MAX_CURRENT = 3;
- const MAX_UPCOMING = 3;
+ // 1080p: 2+2 = 4 events max
+ // 4K: Will scale up automatically via CSS
+ const MAX_CURRENT = 2;
+ const MAX_UPCOMING = 2;
// Current Events (limit to MAX_CURRENT)
if (data.current && data.current.length > 0) {
diff --git a/server.js b/server.js
index 7b29936..48fb692 100644
--- a/server.js
+++ b/server.js
@@ -59,6 +59,33 @@ app.get('/api/notifications', async (req, res) => {
}
});
+ // Sort current events by severity priority, then by starttime
+ // Priority: Incident (danger) > Change (warning) > Awareness/TBD (success)
+ const severityPriority = {
+ 'danger': 1, // Incident - highest priority
+ 'warning': 2, // Change
+ 'success': 3, // Awareness/TBD - lowest priority
+ 'secondary': 4 // Fallback
+ };
+
+ currentEvents.sort((a, b) => {
+ const priorityA = severityPriority[a.typecolor] || 4;
+ const priorityB = severityPriority[b.typecolor] || 4;
+
+ // First sort by priority
+ if (priorityA !== priorityB) {
+ return priorityA - priorityB;
+ }
+
+ // If same priority, sort by starttime (earliest first)
+ return new Date(a.starttime) - new Date(b.starttime);
+ });
+
+ // Upcoming events stay sorted by starttime only
+ upcomingEvents.sort((a, b) => {
+ return new Date(a.starttime) - new Date(b.starttime);
+ });
+
res.json({
success: true,
timestamp: new Date().toISOString(),