diff --git a/backend/src/routes/housekeeping.ts b/backend/src/routes/housekeeping.ts index 16ff5fa..02a4c04 100644 --- a/backend/src/routes/housekeeping.ts +++ b/backend/src/routes/housekeeping.ts @@ -119,6 +119,7 @@ const housekeeping: FastifyPluginAsync = async (fastify) => { WHERE t.id = $1`, [inserted[0].id], ) + broadcast(slug, { type: 'housekeeping_task_created', task: rows[0] }) return reply.code(201).send(rows[0]) }, ) diff --git a/src/components/rooms/RoomContextMenu.tsx b/src/components/rooms/RoomContextMenu.tsx index 30140c6..f57ce29 100644 --- a/src/components/rooms/RoomContextMenu.tsx +++ b/src/components/rooms/RoomContextMenu.tsx @@ -54,6 +54,17 @@ export function RoomContextMenu({ room, x, y, onClose, onStatusChange, onHkStatu const [photoUploading, setPhotoUploading] = useState(false) const photoInputRef = useRef(null) + // Recalculate position whenever content changes (e.g. photos added) + useEffect(() => { + if (ref.current) { + const rect = ref.current.getBoundingClientRect() + const overflowX = rect.right - window.innerWidth + 8 + const overflowY = rect.bottom - window.innerHeight + 8 + if (overflowX > 0) ref.current.style.left = `${rect.left - overflowX}px` + if (overflowY > 0) ref.current.style.top = `${Math.max(8, rect.top - overflowY)}px` + } + }, [techPhotos.length, subForm]) + useEffect(() => { const handler = (e: MouseEvent) => { if (ref.current && !ref.current.contains(e.target as Node)) onClose() @@ -131,8 +142,8 @@ export function RoomContextMenu({ room, x, y, onClose, onStatusChange, onHkStatu return createPortal(
e.preventDefault()} > {/* Header */}