fix: clarify selected zone item count
This commit is contained in:
parent
80f09f324d
commit
96f1cf4625
@ -46,6 +46,7 @@ export default function LocationMapBottomSheet({
|
|||||||
onDeleteObject,
|
onDeleteObject,
|
||||||
}) {
|
}) {
|
||||||
const selectedTitle = selectedObject?.label || selectedObject?.zone_name || "Map Area";
|
const selectedTitle = selectedObject?.label || selectedObject?.zone_name || "Map Area";
|
||||||
|
const selectedItemCountLabel = `${selectedZoneItems.length} item${selectedZoneItems.length === 1 ? "" : "s"}`;
|
||||||
const sheetTitle = mode === "edit"
|
const sheetTitle = mode === "edit"
|
||||||
? selectedObject && editorTool === "edit"
|
? selectedObject && editorTool === "edit"
|
||||||
? "Object Settings"
|
? "Object Settings"
|
||||||
@ -214,7 +215,7 @@ export default function LocationMapBottomSheet({
|
|||||||
<div className="location-map-zone-items">
|
<div className="location-map-zone-items">
|
||||||
<div className="location-map-zone-items-title">
|
<div className="location-map-zone-items-title">
|
||||||
<h2>{selectedTitle}</h2>
|
<h2>{selectedTitle}</h2>
|
||||||
<span>{selectedZoneItems.length}</span>
|
<span>{selectedItemCountLabel}</span>
|
||||||
</div>
|
</div>
|
||||||
{selectedZoneItems.length === 0 ? (
|
{selectedZoneItems.length === 0 ? (
|
||||||
<p className="location-map-muted">No visible items assigned to this zone.</p>
|
<p className="location-map-muted">No visible items assigned to this zone.</p>
|
||||||
|
|||||||
@ -462,7 +462,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.location-map-zone-items-title span {
|
.location-map-zone-items-title span {
|
||||||
min-width: 34px;
|
min-width: 58px;
|
||||||
padding: 0.2rem 0.45rem;
|
padding: 0.2rem 0.45rem;
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
background: rgba(96, 165, 250, 0.18);
|
background: rgba(96, 165, 250, 0.18);
|
||||||
|
|||||||
@ -354,6 +354,8 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({
|
|||||||
await expect(page.getByText("loose batteries")).toHaveCount(0);
|
await expect(page.getByText("loose batteries")).toHaveCount(0);
|
||||||
|
|
||||||
await page.locator(".location-map-object", { hasText: "Bread Wall" }).locator("rect").first().click();
|
await page.locator(".location-map-object", { hasText: "Bread Wall" }).locator("rect").first().click();
|
||||||
|
const zonePanel = page.locator(".location-map-zone-items");
|
||||||
|
await expect(zonePanel.locator(".location-map-zone-items-title span")).toHaveText("2 items");
|
||||||
await expect(page.getByText("french bread")).toBeVisible();
|
await expect(page.getByText("french bread")).toBeVisible();
|
||||||
await expect(page.getByText("sourdough")).toBeVisible();
|
await expect(page.getByText("sourdough")).toBeVisible();
|
||||||
await expect(page.getByText("frozen salmon")).toHaveCount(0);
|
await expect(page.getByText("frozen salmon")).toHaveCount(0);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user