fix: broadcast on task create (realtime), context menu position recalc, CDN_HOST in deploy.sh
This commit is contained in:
@@ -119,6 +119,7 @@ const housekeeping: FastifyPluginAsync = async (fastify) => {
|
|||||||
WHERE t.id = $1`,
|
WHERE t.id = $1`,
|
||||||
[inserted[0].id],
|
[inserted[0].id],
|
||||||
)
|
)
|
||||||
|
broadcast(slug, { type: 'housekeeping_task_created', task: rows[0] })
|
||||||
return reply.code(201).send(rows[0])
|
return reply.code(201).send(rows[0])
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -54,6 +54,17 @@ export function RoomContextMenu({ room, x, y, onClose, onStatusChange, onHkStatu
|
|||||||
const [photoUploading, setPhotoUploading] = useState(false)
|
const [photoUploading, setPhotoUploading] = useState(false)
|
||||||
const photoInputRef = useRef<HTMLInputElement>(null)
|
const photoInputRef = useRef<HTMLInputElement>(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(() => {
|
useEffect(() => {
|
||||||
const handler = (e: MouseEvent) => {
|
const handler = (e: MouseEvent) => {
|
||||||
if (ref.current && !ref.current.contains(e.target as Node)) onClose()
|
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(
|
return createPortal(
|
||||||
<div
|
<div
|
||||||
ref={ref}
|
ref={ref}
|
||||||
className="fixed z-[9999] w-60 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-600 rounded-xl shadow-xl overflow-y-auto select-none"
|
className="fixed z-[9999] w-60 bg-white dark:bg-slate-800 border border-slate-200 dark:border-slate-600 rounded-xl shadow-xl overflow-hidden select-none"
|
||||||
style={{ left: menuX, top: menuY, maxHeight: `${Math.min(window.innerHeight - menuY - 16, window.innerHeight * 0.9)}px` }}
|
style={{ left: menuX, top: menuY }}
|
||||||
onContextMenu={e => e.preventDefault()}
|
onContextMenu={e => e.preventDefault()}
|
||||||
>
|
>
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
|
|||||||
Reference in New Issue
Block a user