diff --git a/frontend/src/components/maps/LocationMapSetupPanel.jsx b/frontend/src/components/maps/LocationMapSetupPanel.jsx index 9f598e1..6336dc9 100644 --- a/frontend/src/components/maps/LocationMapSetupPanel.jsx +++ b/frontend/src/components/maps/LocationMapSetupPanel.jsx @@ -8,16 +8,20 @@ export default function LocationMapSetupPanel({ onCreateFromZones, onCreateBlank, }) { + const description = hasAnyMap + ? canManage + ? "A draft map exists for this location." + : "A map draft exists for this location, but it has not been published yet." + : canManage + ? "Create a rough map for this store location." + : "A household admin has not published a map yet."; + return (

{hasAnyMap ? "Draft Map" : "No Map"}

-

- {hasAnyMap - ? "A draft map exists for this location." - : "Create a rough map for this store location."} -

-
- {hasAnyMap ? ( +

{description}

+ {hasAnyMap && canManage ? ( +
<> - ) : canManage ? ( +
+ ) : !hasAnyMap && canManage ? ( +
<> - ) : ( -

A household admin has not published a map yet.

- )} -
+
+ ) : null}
); } diff --git a/frontend/tests/location-map-manager.spec.ts b/frontend/tests/location-map-manager.spec.ts index a777852..c53f187 100644 --- a/frontend/tests/location-map-manager.spec.ts +++ b/frontend/tests/location-map-manager.spec.ts @@ -578,3 +578,24 @@ test("members can view a published map but cannot edit it", async ({ page }) => await expect(page.getByRole("button", { name: "Save Draft" })).toHaveCount(0); await expect(page.getByRole("button", { name: "Publish" })).toHaveCount(0); }); + +test("members see a clean empty state when no map is published", async ({ page }) => { + await mockMapShell(page, memberHousehold); + + await page.route("**/households/1/locations/10/map", async (route) => { + await route.fulfill({ + status: 200, + contentType: "application/json", + body: JSON.stringify(noMapState(false)), + }); + }); + + await page.goto("/stores/100/locations/10/map"); + + await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible(); + await expect(page.getByText("A household admin has not published a map yet.")).toBeVisible(); + await expect(page.getByText("Create a rough map for this store location.")).toHaveCount(0); + await expect(page.getByRole("button", { name: "Create Map From Existing Zones" })).toHaveCount(0); + await expect(page.getByRole("button", { name: "Create Blank Map" })).toHaveCount(0); + await expect(page.getByLabel("Map controls")).toHaveCount(0); +});