fix: hide zero draft summary rows
This commit is contained in:
parent
5262e89d11
commit
a45f02b727
@ -108,6 +108,11 @@ export default function LocationMapBottomSheet({
|
||||
[mapObjects]
|
||||
);
|
||||
const showDraftOverview = mode === "edit" && editorTool === "edit" && !selectedObject;
|
||||
const draftOverviewRows = [
|
||||
{ label: "Areas", value: totalAreaCount },
|
||||
...(hiddenAreaCount > 0 ? [{ label: "Hidden", value: hiddenAreaCount }] : []),
|
||||
...(unlinkedAreaCount > 0 ? [{ label: "Unlinked", value: unlinkedAreaCount }] : []),
|
||||
];
|
||||
const hiddenUnmappedItemCount = Math.max(0, unmappedItemCount - visibleUnmappedItems.length);
|
||||
const hasHiddenUnmappedItems =
|
||||
filters.showUnmapped && unmappedItemCount > 0 && visibleUnmappedItems.length === 0;
|
||||
@ -258,11 +263,7 @@ export default function LocationMapBottomSheet({
|
||||
{showDraftOverview ? (
|
||||
<LocationMapOverview
|
||||
ariaLabel="Draft map summary"
|
||||
rows={[
|
||||
{ label: "Areas", value: totalAreaCount },
|
||||
{ label: "Hidden", value: hiddenAreaCount },
|
||||
{ label: "Unlinked", value: unlinkedAreaCount },
|
||||
]}
|
||||
rows={draftOverviewRows}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
|
||||
@ -1548,6 +1548,12 @@ test("admin selecting an object does not mark a draft dirty until it changes", a
|
||||
|
||||
await page.getByRole("button", { name: "Continue Editing" }).click();
|
||||
await page.getByRole("button", { name: "Edit Areas" }).click();
|
||||
const summary = page.getByLabel("Draft map summary");
|
||||
await expect(summary.locator(".location-map-overview-row")).toHaveCount(1);
|
||||
await expect(summary.locator(".location-map-overview-row", { hasText: "Areas" }).locator("strong")).toHaveText("1");
|
||||
await expect(summary.locator(".location-map-overview-row", { hasText: "Hidden" })).toHaveCount(0);
|
||||
await expect(summary.locator(".location-map-overview-row", { hasText: "Unlinked" })).toHaveCount(0);
|
||||
|
||||
const bakeryObject = page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first();
|
||||
await bakeryObject.click();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user