Add store location map manager #20
@ -242,8 +242,15 @@ export default function LocationMapCanvas({
|
|||||||
const key = getObjectKey(object);
|
const key = getObjectKey(object);
|
||||||
const isSelected = key === selectedObjectKey;
|
const isSelected = key === selectedObjectKey;
|
||||||
const zoneItems = itemsForZone(mapItems, object.zone_id, filters, username);
|
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 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 labelLines = fittedLabelLines(object, "Area");
|
||||||
const countY = filters.showLabels && labelLines.length > 1 ? object.y + 76 : object.y + 52;
|
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)));
|
const resizeHandleSize = Math.min(96, Math.max(44, Math.ceil(48 / zoom)));
|
||||||
|
|||||||
@ -1442,7 +1442,7 @@ test("viewer explains when selected zone items are hidden by filters", async ({
|
|||||||
await page.goto("/stores/100/locations/10/map");
|
await page.goto("/stores/100/locations/10/map");
|
||||||
|
|
||||||
const frozenArea = page.locator('[data-object-key="1551"]');
|
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 expect(page.locator(".location-map-pin")).toHaveCount(0);
|
||||||
|
|
||||||
await frozenArea.locator("rect").first().click();
|
await frozenArea.locator("rect").first().click();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user