feat: add keyboard navigation for systems

This commit is contained in:
henrygd
2025-03-05 23:35:46 -05:00
parent 5b4d5c648e
commit 0619eabec2
3 changed files with 39 additions and 5 deletions

View File

@@ -22,7 +22,7 @@ import {
import { useEffect } from "react"
import { useStore } from "@nanostores/react"
import { $systems } from "@/lib/stores"
import { getHostDisplayValue, isAdmin } from "@/lib/utils"
import { getHostDisplayValue, isAdmin, listen } from "@/lib/utils"
import { $router, basePath, navigate } from "./router"
import { Trans, t } from "@lingui/macro"
import { getPagePath } from "@nanostores/router"
@@ -37,9 +37,7 @@ export default function CommandPalette({ open, setOpen }: { open: boolean; setOp
setOpen(!open)
}
}
document.addEventListener("keydown", down)
return () => document.removeEventListener("keydown", down)
return listen(document, "keydown", down)
}, [open, setOpen])
return (