fix: compact map setup panel

This commit is contained in:
Nico 2026-06-04 18:09:06 -07:00
parent a2db8cd655
commit 76f3b8b086
2 changed files with 13 additions and 25 deletions

View File

@ -11,11 +11,6 @@ export default function LocationMapSetupPanel({
onCreateBlank,
}) {
const hasZones = zoneCount > 0;
const status = hasAnyMap
? "Draft"
: canManage
? "Not started"
: "Not published";
const createFromZonesLabel = hasZones
? `Create From ${zoneCount} Zone${zoneCount === 1 ? "" : "s"}`
: "Create From Zones";
@ -26,18 +21,14 @@ export default function LocationMapSetupPanel({
return (
<section className="location-map-setup">
<h2>{hasAnyMap ? "Draft Map" : "No Map"}</h2>
<div className="location-map-setup-rows" role="group" aria-label="Map setup status">
<div className="location-map-setup-row">
<span>Status</span>
<strong>{status}</strong>
</div>
{canManage ? (
{canManage ? (
<div className="location-map-setup-rows" role="group" aria-label="Map setup details">
<div className="location-map-setup-row">
<span>Zones</span>
<strong>{zoneCount}</strong>
</div>
) : null}
</div>
</div>
) : null}
{hasAnyMap && canManage ? (
<div className="location-map-setup-actions">
<button type="button" className="btn-primary" onClick={onContinue} disabled={saving}>

View File

@ -434,11 +434,11 @@ test("admin setup uses compact status rows when no zones exist yet", async ({ pa
await page.goto("/stores/100/locations/10/map");
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
const setupStatus = page.getByRole("group", { name: "Map setup status" });
await expect(setupStatus.getByText("Status")).toBeVisible();
await expect(setupStatus.getByText("Not started")).toBeVisible();
await expect(setupStatus.getByText("Zones")).toBeVisible();
await expect(setupStatus.getByText("0")).toBeVisible();
const setupDetails = page.getByRole("group", { name: "Map setup details" });
await expect(setupDetails.locator(".location-map-setup-row")).toHaveCount(1);
await expect(setupDetails.locator(".location-map-setup-row", { hasText: "Zones" })).toContainText("0");
await expect(setupDetails.getByText("Status")).toHaveCount(0);
await expect(page.getByText("Not started")).toHaveCount(0);
await expect(page.getByText("No zones are available yet.")).toHaveCount(0);
await expect(page.getByRole("button", { name: "Create From Zones" })).toBeDisabled();
await expect(page.getByRole("button", { name: "Create Blank Map" })).toBeEnabled();
@ -4131,10 +4131,8 @@ test("members see a clean empty state when no map is published", async ({ page }
await page.goto("/stores/100/locations/10/map");
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
const setupStatus = page.getByRole("group", { name: "Map setup status" });
await expect(setupStatus.getByText("Status")).toBeVisible();
await expect(setupStatus.getByText("Not published")).toBeVisible();
await expect(setupStatus.getByText("Zones")).toHaveCount(0);
await expect(page.getByRole("group", { name: "Map setup details" })).toHaveCount(0);
await expect(page.getByText("Not published")).toHaveCount(0);
await expect(page.getByText("A household admin has not published a map yet.")).toHaveCount(0);
await expect(page.getByText("Not started")).toHaveCount(0);
await expect(page.getByRole("button", { name: /Create From/ })).toHaveCount(0);
@ -4175,9 +4173,8 @@ test("members do not see unpublished draft maps", async ({ page }) => {
await page.goto("/stores/100/locations/10/map");
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
const setupStatus = page.getByRole("group", { name: "Map setup status" });
await expect(setupStatus.getByText("Status")).toBeVisible();
await expect(setupStatus.getByText("Not published")).toBeVisible();
await expect(page.getByRole("group", { name: "Map setup details" })).toHaveCount(0);
await expect(page.getByText("Not published")).toHaveCount(0);
await expect(page.getByText("A household admin has not published a map yet.")).toHaveCount(0);
await expect(page.getByRole("heading", { name: "Draft Map" })).toHaveCount(0);
await expect(page.getByText("A map draft exists for this location")).toHaveCount(0);