From 2389e114690857b494ccfb9f7e1893af6fd9b33a Mon Sep 17 00:00:00 2001 From: Graham McIntie Date: Fri, 13 Feb 2026 19:13:11 -0600 Subject: [PATCH] =?UTF-8?q?feat:=20add=20search=20trigger=20button=20with?= =?UTF-8?q?=20=E2=8C=98K=20hint=20in=20navbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/app.ts | 11 ++++++++++- lib/towerops_web/components/layouts.ex | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/assets/js/app.ts b/assets/js/app.ts index 0006246d..1dfaf8ee 100644 --- a/assets/js/app.ts +++ b/assets/js/app.ts @@ -940,6 +940,15 @@ if (!csrfToken) { const userTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC" // Global Search (Cmd+K / Ctrl+K) hook +const GlobalSearchTrigger = { + mounted() { + this.el.addEventListener("click", () => { + // Simulate Cmd+K to open global search + document.dispatchEvent(new KeyboardEvent("keydown", { key: "k", metaKey: true })) + }) + } +} + const GlobalSearch = { mounted() { this.handleKeydown = (e: KeyboardEvent) => { @@ -965,7 +974,7 @@ const GlobalSearch = { const liveSocket = new LiveSocket("/live", Socket, { longPollFallbackMs: 2500, params: { _csrf_token: csrfToken, timezone: userTimezone }, - hooks: { ...colocatedHooks, SensorChart, CopyToClipboard, ScrollToTop, AutoDismissFlash, BetaBannerDismiss, NetworkMap, DeviceListReorder, MikrotikPortSync, GlobalSearch }, + hooks: { ...colocatedHooks, SensorChart, CopyToClipboard, ScrollToTop, AutoDismissFlash, BetaBannerDismiss, NetworkMap, DeviceListReorder, MikrotikPortSync, GlobalSearch, GlobalSearchTrigger }, }) // Show progress bar on live navigation and form submits diff --git a/lib/towerops_web/components/layouts.ex b/lib/towerops_web/components/layouts.ex index 00c64579..98429368 100644 --- a/lib/towerops_web/components/layouts.ex +++ b/lib/towerops_web/components/layouts.ex @@ -270,6 +270,21 @@ defmodule ToweropsWeb.Layouts do
+ + <.theme_toggle />