From 6eae9ef816bd478d0a806fd4d147b1f980dd4422 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Sun, 5 Apr 2026 11:39:23 -0400 Subject: [PATCH] Add command palette (Ctrl+K / Cmd+K) globally Adds lt-cmd-overlay HTML to layout_header.php and initializes lt.cmdPalette with commands for: navigation (Dashboard, New Ticket), filters (My Tickets, Unassigned, P1 Critical), admin pages (if admin), and recent tickets (last 5 viewed, stored in localStorage). TicketView.php records each viewed ticket ID to localStorage under lt_recent_tickets so the command palette can surface them as Recent. Co-Authored-By: Claude Sonnet 4.6 --- views/TicketView.php | 10 ++++++++ views/layout_header.php | 56 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/views/TicketView.php b/views/TicketView.php index 888018f..381cba0 100644 --- a/views/TicketView.php +++ b/views/TicketView.php @@ -120,6 +120,16 @@ window.ticketData = { }; window.ticketData.id = window.ticketData.ticket_id; if (window.lt) lt.keys.initDefaults(); +// Track recently viewed tickets for command palette +(function() { + try { + var tid = String(window.ticketData.ticket_id); + var key = 'lt_recent_tickets'; + var r = JSON.parse(localStorage.getItem(key) || '[]'); + r = [tid].concat(r.filter(function(x){ return x !== tid; })).slice(0, 5); + localStorage.setItem(key, JSON.stringify(r)); + } catch(_) {} +})(); JS; include __DIR__ . '/layout_header.php'; diff --git a/views/layout_header.php b/views/layout_header.php index 07334dc..bfa2036 100644 --- a/views/layout_header.php +++ b/views/layout_header.php @@ -206,4 +206,60 @@ $_lt_assetVer = $GLOBALS['config']['ASSET_VERSION'] ?? '20260329'; + + + +