Add store location map manager #20

Open
nalalangan wants to merge 206 commits from feature/location-map-manager into feature/store-selector-modal
2 changed files with 10 additions and 3 deletions
Showing only changes of commit 1ab359d343 - Show all commits

View File

@ -53,6 +53,10 @@ export default function LocationMapObject({
if (!object.visible || !filters.showZones) return null; if (!object.visible || !filters.showZones) return null;
const key = getObjectKey(object); const key = getObjectKey(object);
const displayLabel = getMapObjectDisplayLabel(object, index + 1);
const accessibleLabel = canEditObjects && object.locked
? `Map area ${displayLabel}, locked`
: `Map area ${displayLabel}`;
const count = zoneItems.length; const count = zoneItems.length;
const hasHiddenZoneItems = assignedZoneItemCount > count; const hasHiddenZoneItems = assignedZoneItemCount > count;
const countLabel = hasHiddenZoneItems const countLabel = hasHiddenZoneItems
@ -123,7 +127,7 @@ export default function LocationMapObject({
height={object.height} height={object.height}
rx="12" rx="12"
role="button" role="button"
aria-label={`Map area ${getMapObjectDisplayLabel(object, index + 1)}`} aria-label={accessibleLabel}
aria-pressed={isSelected} aria-pressed={isSelected}
tabIndex={canSelect ? 0 : -1} tabIndex={canSelect ? 0 : -1}
onPointerDown={(event) => onStartDrag(event, object, "move")} onPointerDown={(event) => onStartDrag(event, object, "move")}

View File

@ -1808,9 +1808,10 @@ test("admin locked map areas hide resize affordances", async ({ page }) => {
await expect(page.locator(".location-map-resize-handle")).toBeVisible(); await expect(page.locator(".location-map-resize-handle")).toBeVisible();
await expect(page.locator(".location-map-lock-badge")).toHaveCount(0); await expect(page.locator(".location-map-lock-badge")).toHaveCount(0);
await expect(page.getByRole("button", { name: "Map area Bakery, locked", exact: true })).toHaveCount(0);
await expect(page.getByRole("spinbutton", { name: "X" })).toHaveCount(0); await expect(page.getByRole("spinbutton", { name: "X" })).toHaveCount(0);
const lockedToggle = page.getByRole("button", { name: "Locked" }); const lockedToggle = page.getByRole("button", { name: "Locked", exact: true });
const visibleToggle = page.getByRole("button", { name: "Visible" }); const visibleToggle = page.getByRole("button", { name: "Visible", exact: true });
await expect(lockedToggle).toHaveAttribute("aria-pressed", "false"); await expect(lockedToggle).toHaveAttribute("aria-pressed", "false");
await lockedToggle.click(); await lockedToggle.click();
@ -1824,6 +1825,7 @@ test("admin locked map areas hide resize affordances", async ({ page }) => {
await expect(page.locator(".location-map-resize-handle")).toHaveCount(0); await expect(page.locator(".location-map-resize-handle")).toHaveCount(0);
await expect(page.locator(".location-map-lock-badge")).toBeVisible(); await expect(page.locator(".location-map-lock-badge")).toBeVisible();
await expect(bakeryObject).toHaveClass(/is-locked/); await expect(bakeryObject).toHaveClass(/is-locked/);
await expect(page.getByRole("button", { name: "Map area Bakery, locked", exact: true })).toBeVisible();
await expect(page.getByText("Unlock this area before moving or resizing it.")).toHaveCount(0); await expect(page.getByText("Unlock this area before moving or resizing it.")).toHaveCount(0);
await expect(page.locator(".location-map-status")).toHaveText("Unsaved Draft"); await expect(page.locator(".location-map-status")).toHaveText("Unsaved Draft");
@ -1835,6 +1837,7 @@ test("admin locked map areas hide resize affordances", async ({ page }) => {
await expect(lockedToggle).toHaveAttribute("aria-pressed", "false"); await expect(lockedToggle).toHaveAttribute("aria-pressed", "false");
await expect(page.locator(".location-map-resize-handle")).toBeVisible(); await expect(page.locator(".location-map-resize-handle")).toBeVisible();
await expect(page.locator(".location-map-lock-badge")).toHaveCount(0); await expect(page.locator(".location-map-lock-badge")).toHaveCount(0);
await expect(page.getByRole("button", { name: "Map area Bakery, locked", exact: true })).toHaveCount(0);
}); });
test("admin selected overlapping map area renders above other areas", async ({ page }) => { test("admin selected overlapping map area renders above other areas", async ({ page }) => {