fix: broadcast on task create (realtime), context menu position recalc, CDN_HOST in deploy.sh
This commit is contained in:
@@ -54,6 +54,17 @@ export function RoomContextMenu({ room, x, y, onClose, onStatusChange, onHkStatu
|
||||
const [photoUploading, setPhotoUploading] = useState(false)
|
||||
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(() => {
|
||||
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(
|
||||
<div
|
||||
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"
|
||||
style={{ left: menuX, top: menuY, maxHeight: `${Math.min(window.innerHeight - menuY - 16, window.innerHeight * 0.9)}px` }}
|
||||
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 }}
|
||||
onContextMenu={e => e.preventDefault()}
|
||||
>
|
||||
{/* Header */}
|
||||
|
||||
Reference in New Issue
Block a user