Add store location map manager #20
@ -55,13 +55,18 @@ export default function LocationMapBottomSheet({
|
|||||||
: `${selectedZoneItems.length} item${selectedZoneItems.length === 1 ? "" : "s"}`;
|
: `${selectedZoneItems.length} item${selectedZoneItems.length === 1 ? "" : "s"}`;
|
||||||
const sheetTitle = mode === "edit"
|
const sheetTitle = mode === "edit"
|
||||||
? selectedObject && editorTool === "edit"
|
? selectedObject && editorTool === "edit"
|
||||||
? "Object Settings"
|
? selectedTitle
|
||||||
: editorTool === "edit"
|
: editorTool === "edit"
|
||||||
? "Edit Objects"
|
? "Edit Objects"
|
||||||
: "Pan Mode"
|
: "Pan Mode"
|
||||||
: selectedObject
|
: selectedObject
|
||||||
? selectedTitle
|
? selectedTitle
|
||||||
: "Map Details";
|
: "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 showEditorControls = mode === "edit" && canManage;
|
||||||
const showSelectedObjectForm = Boolean(mode === "edit" && editorTool === "edit" && selectedObject);
|
const showSelectedObjectForm = Boolean(mode === "edit" && editorTool === "edit" && selectedObject);
|
||||||
const showSelectedZoneItems = () => {
|
const showSelectedZoneItems = () => {
|
||||||
@ -104,7 +109,7 @@ export default function LocationMapBottomSheet({
|
|||||||
<div>
|
<div>
|
||||||
<strong>{sheetTitle}</strong>
|
<strong>{sheetTitle}</strong>
|
||||||
{mode === "edit" && canManage ? (
|
{mode === "edit" && canManage ? (
|
||||||
<span>{editorTool === "edit" ? "Move, resize, and configure selected areas." : "Drag and zoom without changing objects."}</span>
|
<span>{sheetDescription}</span>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
|||||||
@ -338,6 +338,9 @@
|
|||||||
.location-map-sheet-header strong {
|
.location-map-sheet-header strong {
|
||||||
display: block;
|
display: block;
|
||||||
color: #f8fafc;
|
color: #f8fafc;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.location-map-sheet-header > div span {
|
.location-map-sheet-header > div span {
|
||||||
|
|||||||
@ -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();
|
await page.getByRole("button", { name: "Edit Objects" }).click();
|
||||||
const bakeryObject = page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first();
|
const bakeryObject = page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first();
|
||||||
await bakeryObject.click();
|
await bakeryObject.click();
|
||||||
|
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bakery");
|
||||||
const moveBox = await bakeryObject.boundingBox();
|
const moveBox = await bakeryObject.boundingBox();
|
||||||
expect(moveBox).not.toBeNull();
|
expect(moveBox).not.toBeNull();
|
||||||
if (!moveBox) throw new Error("Bakery map object could not be moved");
|
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.mouse.up();
|
||||||
|
|
||||||
await page.getByRole("textbox", { name: "Label" }).fill("Bread Wall");
|
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 page.getByRole("button", { name: "Duplicate" }).click();
|
||||||
await expect(page.getByRole("textbox", { name: "Label" })).toHaveValue("Bread Wall Copy");
|
await expect(page.getByRole("textbox", { name: "Label" })).toHaveValue("Bread Wall Copy");
|
||||||
await page.getByLabel("Linked zone").selectOption("502");
|
await page.getByLabel("Linked zone").selectOption("502");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user