diff --git a/CageUI/ios-webpack/watch.config.js b/CageUI/ios-webpack/watch.config.js index 4d9097055..fada5a1c0 100644 --- a/CageUI/ios-webpack/watch.config.js +++ b/CageUI/ios-webpack/watch.config.js @@ -22,7 +22,7 @@ const constants = require('./constants'); const path = require('path'); // relative to the /node_modules/@labkey/build/webpack dir const entryPoints = require('../src/client/entryPoints.js'); -const host = require("host"); +const host = require("./host"); const devServer = { diff --git a/CageUI/resources/web/CageUI/static/legend.svg b/CageUI/resources/web/CageUI/static/legend.svg index 9598caf23..049a54036 100644 --- a/CageUI/resources/web/CageUI/static/legend.svg +++ b/CageUI/resources/web/CageUI/static/legend.svg @@ -61,83 +61,39 @@ - S - olid Divider + Solid Divider - P - r - o - t - e - c - t - ed - C - o - n - ta - c - t Divider + Protected Contact Divider - V - isual - C - o - n - ta - c - t Divider + Visual Contact Divider - P - r - i - v - a - c - y Divider + Privacy Divider - S - tanda - r - d - F - loor + Standard Floor - M - esh - F - loor + Mesh Floor - M - esh - F - loor x2 + Mesh Floor x2 - E - x - t - ension + Extension - C - - - T - unnel + C-Tunnel @@ -151,9 +107,6 @@ - S - ocial - P - anel Divider + Social Panel Divider \ No newline at end of file diff --git a/CageUI/src/client/components/layoutEditor/EditorContextMenu.tsx b/CageUI/src/client/components/layoutEditor/EditorContextMenu.tsx index 3c960c85c..31604f82d 100644 --- a/CageUI/src/client/components/layoutEditor/EditorContextMenu.tsx +++ b/CageUI/src/client/components/layoutEditor/EditorContextMenu.tsx @@ -64,7 +64,7 @@ export const EditorContextMenu: FC = (props) => { type } = props; - const menuRef = useRef(null); + const menuRef = useRef(null); // Delete object for room objects const handleDeleteObject = (e: React.MouseEvent) => { @@ -97,7 +97,44 @@ export const EditorContextMenu: FC = (props) => { return () => { document.removeEventListener('mousedown', handleClickOutside); }; - }, [menuRef]); + }, [closeMenu]); + + // Handle dynamic positioning + useEffect(() => { + if (!menuRef.current || ctxMenuStyle.display !== 'block') return; + + const menu = menuRef.current; + const { top, left } = ctxMenuStyle; + const topValue = parseInt(top, 10); + const leftValue = parseInt(left, 10); + + const windowWidth = window.innerWidth; + const windowHeight = window.innerHeight; + const menuWidth = menu.offsetWidth; + const menuHeight = menu.offsetHeight; + + let adjustedTop = topValue; + let adjustedLeft = leftValue; + + // Prevent overflow to the right + if (leftValue + menuWidth > windowWidth) { + adjustedLeft = windowWidth - menuWidth - 10; + } + + // Prevent overflow to the bottom + if (topValue + menuHeight > windowHeight) { + adjustedTop = windowHeight - menuHeight - 10; + } + + // Prevent overflow to the left + if (adjustedLeft < 10) adjustedLeft = 10; + + // Prevent overflow to the top + if (adjustedTop < 10) adjustedTop = 10; + + menu.style.left = `${adjustedLeft}px`; + menu.style.top = `${adjustedTop}px`; + }, [ctxMenuStyle.display, ctxMenuStyle.left, ctxMenuStyle.top]); return (
= (props) => { } if (templateName.length > 0) { - //return if new name doesn't have word template in it - if (!templateName.includes('template')) { - onCancel(); - return; - } + const newTemplateName = "template-" + templateName; // if template, save old template name for later setRoom(prevState => ({ ...prevState, - name: templateName + name: newTemplateName })); templateRename(selectedRoom); } else { @@ -109,7 +105,7 @@ export const RoomSelectorPopup: FC = (props) => { setTemplateName("template-" + e.target.value)} + onChange={(e) => setTemplateName(e.target.value)} />
} diff --git a/CageUI/src/client/utils/helpers.ts b/CageUI/src/client/utils/helpers.ts index 9936496c2..1ce43272a 100644 --- a/CageUI/src/client/utils/helpers.ts +++ b/CageUI/src/client/utils/helpers.ts @@ -758,13 +758,7 @@ export const buildNewLocalRoom = async (prevRoom: PrevRoom): Promise<[Room, Unit cageNumType = roomItemToString(defaultTypeToRackType(rackItem.objectType as DefaultRackTypes)); } - let cageMods: CageModificationsType = { - [ModLocations.Top]: [], - [ModLocations.Bottom]: [], - [ModLocations.Left]: [], - [ModLocations.Right]: [], - [ModLocations.Direct]: [] - }; + let cageMods: CageModificationsType; if (rackItem.extraContext) { extraContext = JSON.parse(rackItem.extraContext); } @@ -772,6 +766,13 @@ export const buildNewLocalRoom = async (prevRoom: PrevRoom): Promise<[Room, Unit // This is where mods are loaded into state for the room if (loadMods && !rack.type.isDefault) { + cageMods = { + [ModLocations.Top]: [], + [ModLocations.Bottom]: [], + [ModLocations.Left]: [], + [ModLocations.Right]: [], + [ModLocations.Direct]: [] + }; const modReturnData = await cageModLookup([], []); const availMods = modReturnData.map(row => ({value: row.value, label: row.title}));