fix: clarify filtered zone map counts

This commit is contained in:
Nico 2026-06-03 22:08:09 -07:00
parent 214e2626fe
commit 0a16ad3e7e
2 changed files with 9 additions and 2 deletions

View File

@ -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)));

View File

@ -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();