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 59 additions and 1 deletions
Showing only changes of commit ad74262604 - Show all commits

View File

@ -559,7 +559,7 @@
}
.location-map-bottom-sheet {
max-height: 38dvh;
max-height: 34dvh;
}
.location-map-topbar {

View File

@ -480,6 +480,64 @@ test("viewer wraps long zone labels and keeps item counts visible", async ({ pag
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "92");
});
test("mobile editor uses bottom sheet controls instead of desktop object toolbar", async ({ page }) => {
await page.setViewportSize({ width: 390, height: 844 });
await mockMapShell(page);
const mapState = draftMapState([
{
id: 1601,
location_map_id: 900,
zone_id: 501,
zone_name: "Bakery",
type: "zone",
label: "Bakery",
x: 40,
y: 40,
width: 260,
height: 160,
rotation: 0,
locked: false,
visible: true,
sort_order: 1,
},
], true);
await page.route("**/households/1/locations/10/map", async (route) => {
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify(mapState),
});
});
await page.goto("/stores/100/locations/10/map");
await expect(page.getByRole("heading", { name: "Costco" })).toBeVisible();
await expect(page.getByText("Eastvale")).toBeVisible();
await expect(page.getByRole("heading", { name: "Draft Map" })).toBeVisible();
await page.getByRole("button", { name: "Continue Editing" }).click();
await expect(page.getByLabel("Map controls")).toBeVisible();
await expect(page.locator(".location-map-tool-buttons")).toBeHidden();
await expect(page.locator(".location-map-mobile-tool-switch")).toBeVisible();
await expect(page.getByRole("button", { name: "Pan" })).toBeVisible();
await expect(page.getByRole("button", { name: "Objects" })).toBeVisible();
await expect(page.locator(".location-map-pin")).toHaveCount(0);
const canvasBox = await page.locator(".location-map-canvas-shell").boundingBox();
const sheetBox = await page.locator(".location-map-bottom-sheet").boundingBox();
expect(canvasBox).not.toBeNull();
expect(sheetBox).not.toBeNull();
if (!canvasBox || !sheetBox) throw new Error("Mobile map layout was not measurable");
expect(canvasBox.height).toBeGreaterThan(260);
expect(sheetBox.height).toBeLessThanOrEqual(360);
await page.getByRole("button", { name: "Objects" }).click();
await page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first().click();
await expect(page.getByRole("textbox", { name: "Label" })).toBeVisible();
});
test("members can view a published map but cannot edit it", async ({ page }) => {
await mockMapShell(page, memberHousehold);