mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
fix(link): delete link should disabled all key outside confirm
This commit is contained in:
@@ -5,16 +5,19 @@ import { LinkHeader } from "@/components/routes/link/header"
|
||||
import { LinkList } from "@/components/routes/link/list"
|
||||
import { LinkManage } from "@/components/routes/link/manage"
|
||||
import { useQueryState } from "nuqs"
|
||||
import { useAtom } from "jotai"
|
||||
import { atom, useAtom } from "jotai"
|
||||
import { linkEditIdAtom } from "@/store/link"
|
||||
import { LinkBottomBar } from "./bottom-bar"
|
||||
import { commandPaletteOpenAtom } from "@/components/custom/command-palette/command-palette"
|
||||
|
||||
export const isDeleteConfirmShownAtom = atom(false)
|
||||
|
||||
export function LinkRoute(): React.ReactElement {
|
||||
const [, setEditId] = useAtom(linkEditIdAtom)
|
||||
const [nuqsEditId] = useQueryState("editId")
|
||||
const [activeItemIndex, setActiveItemIndex] = useState<number | null>(null)
|
||||
const [isCommandPaletteOpen] = useAtom(commandPaletteOpenAtom)
|
||||
const [isDeleteConfirmShown] = useAtom(isDeleteConfirmShownAtom)
|
||||
const [disableEnterKey, setDisableEnterKey] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
@@ -32,6 +35,10 @@ export function LinkRoute(): React.ReactElement {
|
||||
}
|
||||
}, [isCommandPaletteOpen, handleCommandPaletteClose])
|
||||
|
||||
useEffect(() => {
|
||||
setDisableEnterKey(isDeleteConfirmShown || isCommandPaletteOpen)
|
||||
}, [isDeleteConfirmShown, isCommandPaletteOpen])
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-auto flex-col overflow-hidden">
|
||||
<LinkHeader />
|
||||
|
||||
Reference in New Issue
Block a user