keep overnight checkout planning after a later arrival

This commit is contained in:
Maurice
2026-09-12 16:22:11 +02:00
parent bc15036cfb
commit bc04072dc9
12 changed files with 39 additions and 10 deletions
@@ -20,7 +20,7 @@ describe('useContextMenu', () => {
result.current.open({ clientX: 120, clientY: 40, preventDefault, stopPropagation } as unknown as React.MouseEvent, items)
})
expect(result.current.menu).toEqual({ x: 120, y: 40, items })
expect(result.current.menu).toEqual({ x: 120, y: 40, items, alignEnd: false })
expect(preventDefault).toHaveBeenCalled()
expect(stopPropagation).toHaveBeenCalled()
})
+1 -1
View File
@@ -23,7 +23,7 @@ export function useContextMenu() {
const open = (e: React.MouseEvent, items: MenuItem[], alignEnd = false) => {
e.preventDefault()
e.stopPropagation()
const anchor = e.currentTarget.getBoundingClientRect()
const anchor = alignEnd ? e.currentTarget.getBoundingClientRect() : { right: e.clientX, bottom: e.clientY }
setMenu({ x: alignEnd ? anchor.right : e.clientX, y: alignEnd ? anchor.bottom + 6 : e.clientY, items, alignEnd })
}