fix: identify selected map area

This commit is contained in:
Nico 2026-06-03 14:52:42 -07:00
parent eb89c1f6fc
commit eef8accf45
3 changed files with 12 additions and 2 deletions

View File

@ -55,13 +55,18 @@ export default function LocationMapBottomSheet({
: `${selectedZoneItems.length} item${selectedZoneItems.length === 1 ? "" : "s"}`;
const sheetTitle = mode === "edit"
? selectedObject && editorTool === "edit"
? "Object Settings"
? selectedTitle
: editorTool === "edit"
? "Edit Objects"
: "Pan Mode"
: selectedObject
? selectedTitle
: "Map Details";
const sheetDescription = selectedObject && editorTool === "edit"
? "Move, resize, link, or rename this area."
: editorTool === "edit"
? "Tap an area to select it."
: "Drag and zoom without changing objects.";
const showEditorControls = mode === "edit" && canManage;
const showSelectedObjectForm = Boolean(mode === "edit" && editorTool === "edit" && selectedObject);
const showSelectedZoneItems = () => {
@ -104,7 +109,7 @@ export default function LocationMapBottomSheet({
<div>
<strong>{sheetTitle}</strong>
{mode === "edit" && canManage ? (
<span>{editorTool === "edit" ? "Move, resize, and configure selected areas." : "Drag and zoom without changing objects."}</span>
<span>{sheetDescription}</span>
) : null}
</div>
<button

View File

@ -338,6 +338,9 @@
.location-map-sheet-header strong {
display: block;
color: #f8fafc;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.location-map-sheet-header > div span {

View File

@ -287,6 +287,7 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({
await page.getByRole("button", { name: "Edit Objects" }).click();
const bakeryObject = page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first();
await bakeryObject.click();
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bakery");
const moveBox = await bakeryObject.boundingBox();
expect(moveBox).not.toBeNull();
if (!moveBox) throw new Error("Bakery map object could not be moved");
@ -312,6 +313,7 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({
await page.mouse.up();
await page.getByRole("textbox", { name: "Label" }).fill("Bread Wall");
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bread Wall");
await page.getByRole("button", { name: "Duplicate" }).click();
await expect(page.getByRole("textbox", { name: "Label" })).toHaveValue("Bread Wall Copy");
await page.getByLabel("Linked zone").selectOption("502");