fix(link): Navigate between item and fix Enter keybind (#165)

* feat: add item scroll to active

* fix: reset enterkey and scroll to view

* fix: link item displayName
This commit is contained in:
Aslam
2024-09-19 21:11:52 +07:00
committed by GitHub
parent 8871a8959c
commit afaef5d3c5
5 changed files with 167 additions and 129 deletions

View File

@@ -8,11 +8,12 @@ import { parseAsBoolean, useQueryState } from "nuqs"
import { atom, useAtom } from "jotai"
import { LinkBottomBar } from "./bottom-bar"
import { commandPaletteOpenAtom } from "@/components/custom/command-palette/command-palette"
import { useKey } from "react-use"
export const isDeleteConfirmShownAtom = atom(false)
export function LinkRoute(): React.ReactElement {
const [nuqsEditId] = useQueryState("editId")
const [nuqsEditId, setNuqsEditId] = useQueryState("editId")
const [activeItemIndex, setActiveItemIndex] = useState<number | null>(null)
const [isInCreateMode] = useQueryState("create", parseAsBoolean)
const [isCommandPaletteOpen] = useAtom(commandPaletteOpenAtom)
@@ -50,6 +51,11 @@ export function LinkRoute(): React.ReactElement {
}
}, [isDeleteConfirmShown, isCommandPaletteOpen, isInCreateMode, handleCommandPaletteClose])
useKey("Escape", () => {
setDisableEnterKey(false)
setNuqsEditId(null)
})
return (
<>
<LinkHeader />