From 417b707e8ecedd8e55c35a86d99c85a2b0239663 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Tue, 20 Jan 2026 05:42:29 -0800 Subject: feat: Add command palette for quick navigation --- internal/server/static/style.css | 133 ++++++++++++++++++++++++ internal/server/templates/index.html | 196 ++++++++++++++++++++++++++++++++++- 2 files changed, 328 insertions(+), 1 deletion(-) diff --git a/internal/server/static/style.css b/internal/server/static/style.css index 2e57537..ebff1dc 100644 --- a/internal/server/static/style.css +++ b/internal/server/static/style.css @@ -402,3 +402,136 @@ svg { fill: none; } [data-tooltip] { cursor: help; } + +/* Command Palette */ +.command-palette { + display: none; + position: fixed; + inset: 0; + z-index: 2000; +} + +.command-palette.visible { + display: block; +} + +.command-palette-backdrop { + position: absolute; + inset: 0; + background: rgba(0, 0, 0, 0.5); +} + +.command-palette-container { + position: absolute; + top: 20%; + left: 50%; + transform: translateX(-50%); + width: 90%; + max-width: 32rem; + background: var(--bg-primary); + border: 1px solid var(--border-color); + overflow: hidden; +} + +.command-input { + width: 100%; + padding: 0.75rem 1rem; + background: var(--bg-secondary); + border: none; + border-bottom: 1px solid var(--border-color); + color: var(--text-primary); + font-family: inherit; + font-size: 0.875rem; + outline: none; +} + +.command-input::placeholder { + color: var(--text-tertiary); +} + +.command-results { + max-height: 20rem; + overflow-y: auto; +} + +.command-item { + display: flex; + align-items: center; + gap: 0.75rem; + padding: 0.6rem 1rem; + cursor: pointer; + border-bottom: 1px solid var(--border-color); +} + +.command-item:last-child { + border-bottom: none; +} + +.command-item:hover, +.command-item.selected { + background: var(--bg-tertiary); +} + +.command-item-icon { + width: 1rem; + height: 1rem; + color: var(--text-tertiary); + flex-shrink: 0; +} + +.command-item-content { + flex: 1; + min-width: 0; +} + +.command-item-name { + color: var(--text-primary); + font-size: 0.75rem; +} + +.command-item-type { + color: var(--text-tertiary); + font-size: 0.6875rem; + text-transform: uppercase; +} + +.command-item-path { + color: var(--text-tertiary); + font-size: 0.6875rem; +} + +.command-hint { + display: flex; + gap: 1rem; + padding: 0.5rem 1rem; + background: var(--bg-secondary); + border-top: 1px solid var(--border-color); + font-size: 0.6875rem; + color: var(--text-tertiary); +} + +.command-hint kbd { + display: inline-block; + padding: 0.1rem 0.3rem; + background: var(--bg-tertiary); + border: 1px solid var(--border-color); + font-family: inherit; + font-size: 0.625rem; +} + +.command-empty { + padding: 1.5rem 1rem; + text-align: center; + color: var(--text-tertiary); + font-size: 0.75rem; +} + +/* Highlight for jumped-to items */ +.highlight-jump { + animation: highlight-pulse 1s ease-out; +} + +@keyframes highlight-pulse { + 0% { background-color: var(--bg-tertiary); } + 100% { background-color: transparent; } +} diff --git a/internal/server/templates/index.html b/internal/server/templates/index.html index d689416..b5a2462 100644 --- a/internal/server/templates/index.html +++ b/internal/server/templates/index.html @@ -78,7 +78,7 @@
{{range .Monitors}} {{$monitor := .}} -
+
@@ -196,6 +196,20 @@
+ +
+
+
+ +
+
+ ↑↓ navigate + select + esc close +
+
+
+ -- cgit v1.2.3