fix: compact map counts without labels

This commit is contained in:
Nico 2026-06-03 11:44:01 -07:00
parent 5b964eef1f
commit 80f09f324d
2 changed files with 8 additions and 1 deletions

View File

@ -176,7 +176,7 @@ export default function LocationMapCanvas({
const count = zoneItems.length;
const countLabel = `${count} item${count === 1 ? "" : "s"}`;
const labelLines = fittedLabelLines(object, "Area");
const countY = labelLines.length > 1 ? object.y + 76 : object.y + 52;
const countY = filters.showLabels && labelLines.length > 1 ? object.y + 76 : object.y + 52;
const pinDots = filters.showPins
? zoneItems.slice(0, 12).map((item, itemIndex) => {
const column = itemIndex % 4;

View File

@ -460,7 +460,14 @@ test("viewer wraps long zone labels and keeps item counts visible", async ({ pag
await expect(produceArea.locator(".location-map-label tspan").nth(0)).toHaveText("Produce & Fresh");
await expect(produceArea.locator(".location-map-label tspan").nth(1)).toHaveText("Vegetables");
await expect(produceArea.locator(".location-map-count")).toHaveText("2 items");
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "116");
await expect(page.locator(".location-map-pin")).toHaveCount(0);
await page.getByRole("button", { name: "Layers" }).click();
await page.getByLabel("Labels").uncheck();
await expect(produceArea.locator(".location-map-label")).toHaveCount(0);
await expect(produceArea.locator(".location-map-count")).toHaveText("2 items");
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "92");
});
test("members can view a published map but cannot edit it", async ({ page }) => {