diff --git a/frontend/src/components/maps/LocationMapCanvas.jsx b/frontend/src/components/maps/LocationMapCanvas.jsx index 93c1293..c0208df 100644 --- a/frontend/src/components/maps/LocationMapCanvas.jsx +++ b/frontend/src/components/maps/LocationMapCanvas.jsx @@ -242,8 +242,15 @@ export default function LocationMapCanvas({ const key = getObjectKey(object); const isSelected = key === selectedObjectKey; const zoneItems = itemsForZone(mapItems, object.zone_id, filters, username); + const assignedZoneItemCount = object.zone_id + ? mapItems.filter( + (item) => String(item.zone_id || "") === String(object.zone_id || "") + ).length + : 0; const count = zoneItems.length; - const countLabel = `${count} item${count === 1 ? "" : "s"}`; + const countLabel = assignedZoneItemCount > 0 && count === 0 + ? "0 shown" + : `${count} item${count === 1 ? "" : "s"}`; const labelLines = fittedLabelLines(object, "Area"); const countY = filters.showLabels && labelLines.length > 1 ? object.y + 76 : object.y + 52; const resizeHandleSize = Math.min(96, Math.max(44, Math.ceil(48 / zoom))); diff --git a/frontend/tests/location-map-manager.spec.ts b/frontend/tests/location-map-manager.spec.ts index d93d649..41458d6 100644 --- a/frontend/tests/location-map-manager.spec.ts +++ b/frontend/tests/location-map-manager.spec.ts @@ -1442,7 +1442,7 @@ test("viewer explains when selected zone items are hidden by filters", async ({ await page.goto("/stores/100/locations/10/map"); const frozenArea = page.locator('[data-object-key="1551"]'); - await expect(frozenArea.locator(".location-map-count")).toHaveText("0 items"); + await expect(frozenArea.locator(".location-map-count")).toHaveText("0 shown"); await expect(page.locator(".location-map-pin")).toHaveCount(0); await frozenArea.locator("rect").first().click();