Feature: Add type-based color coding and optimize for TV display
- Extended time window from 48 hours to 72 hours - Added isshopfloor filter - only show notifications marked for shopfloor - Added JOIN with notificationtypes table to get type colors - Implemented type-based color coding with 40px thick left border: * Green (#0ad64f) for Awareness and TBD types * Yellow (#ffc107) for Change type * Red (#dc3545) for Incident type - Optimized layout for single-screen TV display (no scrolling): * Reduced all font sizes and spacing significantly * Set overflow: hidden and height: 100vh on body * Reduced header, section titles, event cards, and footer sizes - Limited display to 3 current + 3 upcoming events max - Shows "+ X more event(s)" indicator when needed - Positioned LIVE badge in absolute top-right corner - Updated all text references from 48 hours to 72 hours 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
17
server.js
17
server.js
@@ -27,17 +27,20 @@ app.use(express.static('public'));
|
||||
app.get('/api/notifications', async (req, res) => {
|
||||
try {
|
||||
const now = new Date();
|
||||
const future = new Date(now.getTime() + (48 * 60 * 60 * 1000)); // 48 hours from now
|
||||
const future = new Date(now.getTime() + (72 * 60 * 60 * 1000)); // 72 hours from now
|
||||
|
||||
const [rows] = await promisePool.query(
|
||||
`SELECT notificationid, notification, starttime, endtime, ticketnumber, link, isactive
|
||||
FROM notifications
|
||||
WHERE isactive = 1
|
||||
`SELECT n.notificationid, n.notification, n.starttime, n.endtime, n.ticketnumber, n.link,
|
||||
n.isactive, n.isshopfloor, nt.typename, nt.typecolor
|
||||
FROM notifications n
|
||||
LEFT JOIN notificationtypes nt ON n.notificationtypeid = nt.notificationtypeid
|
||||
WHERE n.isactive = 1
|
||||
AND n.isshopfloor = 1
|
||||
AND (
|
||||
(starttime <= ? AND (endtime IS NULL OR endtime >= ?))
|
||||
OR (starttime BETWEEN ? AND ?)
|
||||
(n.starttime <= ? AND (n.endtime IS NULL OR n.endtime >= ?))
|
||||
OR (n.starttime BETWEEN ? AND ?)
|
||||
)
|
||||
ORDER BY starttime ASC`,
|
||||
ORDER BY n.starttime ASC`,
|
||||
[future, now, now, future]
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user