Add store location map manager #20
@ -11,11 +11,6 @@ export default function LocationMapSetupPanel({
|
|||||||
onCreateBlank,
|
onCreateBlank,
|
||||||
}) {
|
}) {
|
||||||
const hasZones = zoneCount > 0;
|
const hasZones = zoneCount > 0;
|
||||||
const status = hasAnyMap
|
|
||||||
? "Draft"
|
|
||||||
: canManage
|
|
||||||
? "Not started"
|
|
||||||
: "Not published";
|
|
||||||
const createFromZonesLabel = hasZones
|
const createFromZonesLabel = hasZones
|
||||||
? `Create From ${zoneCount} Zone${zoneCount === 1 ? "" : "s"}`
|
? `Create From ${zoneCount} Zone${zoneCount === 1 ? "" : "s"}`
|
||||||
: "Create From Zones";
|
: "Create From Zones";
|
||||||
@ -26,18 +21,14 @@ export default function LocationMapSetupPanel({
|
|||||||
return (
|
return (
|
||||||
<section className="location-map-setup">
|
<section className="location-map-setup">
|
||||||
<h2>{hasAnyMap ? "Draft Map" : "No Map"}</h2>
|
<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">
|
<div className="location-map-setup-row">
|
||||||
<span>Zones</span>
|
<span>Zones</span>
|
||||||
<strong>{zoneCount}</strong>
|
<strong>{zoneCount}</strong>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
|
) : null}
|
||||||
{hasAnyMap && canManage ? (
|
{hasAnyMap && canManage ? (
|
||||||
<div className="location-map-setup-actions">
|
<div className="location-map-setup-actions">
|
||||||
<button type="button" className="btn-primary" onClick={onContinue} disabled={saving}>
|
<button type="button" className="btn-primary" onClick={onContinue} disabled={saving}>
|
||||||
|
|||||||
@ -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 page.goto("/stores/100/locations/10/map");
|
||||||
|
|
||||||
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
|
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
|
||||||
const setupStatus = page.getByRole("group", { name: "Map setup status" });
|
const setupDetails = page.getByRole("group", { name: "Map setup details" });
|
||||||
await expect(setupStatus.getByText("Status")).toBeVisible();
|
await expect(setupDetails.locator(".location-map-setup-row")).toHaveCount(1);
|
||||||
await expect(setupStatus.getByText("Not started")).toBeVisible();
|
await expect(setupDetails.locator(".location-map-setup-row", { hasText: "Zones" })).toContainText("0");
|
||||||
await expect(setupStatus.getByText("Zones")).toBeVisible();
|
await expect(setupDetails.getByText("Status")).toHaveCount(0);
|
||||||
await expect(setupStatus.getByText("0")).toBeVisible();
|
await expect(page.getByText("Not started")).toHaveCount(0);
|
||||||
await expect(page.getByText("No zones are available yet.")).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 From Zones" })).toBeDisabled();
|
||||||
await expect(page.getByRole("button", { name: "Create Blank Map" })).toBeEnabled();
|
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 page.goto("/stores/100/locations/10/map");
|
||||||
|
|
||||||
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
|
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
|
||||||
const setupStatus = page.getByRole("group", { name: "Map setup status" });
|
await expect(page.getByRole("group", { name: "Map setup details" })).toHaveCount(0);
|
||||||
await expect(setupStatus.getByText("Status")).toBeVisible();
|
await expect(page.getByText("Not published")).toHaveCount(0);
|
||||||
await expect(setupStatus.getByText("Not published")).toBeVisible();
|
|
||||||
await expect(setupStatus.getByText("Zones")).toHaveCount(0);
|
|
||||||
await expect(page.getByText("A household admin has not published a map yet.")).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.getByText("Not started")).toHaveCount(0);
|
||||||
await expect(page.getByRole("button", { name: /Create From/ })).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 page.goto("/stores/100/locations/10/map");
|
||||||
|
|
||||||
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
|
await expect(page.getByRole("heading", { name: "No Map" })).toBeVisible();
|
||||||
const setupStatus = page.getByRole("group", { name: "Map setup status" });
|
await expect(page.getByRole("group", { name: "Map setup details" })).toHaveCount(0);
|
||||||
await expect(setupStatus.getByText("Status")).toBeVisible();
|
await expect(page.getByText("Not published")).toHaveCount(0);
|
||||||
await expect(setupStatus.getByText("Not published")).toBeVisible();
|
|
||||||
await expect(page.getByText("A household admin has not published a map yet.")).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.getByRole("heading", { name: "Draft Map" })).toHaveCount(0);
|
||||||
await expect(page.getByText("A map draft exists for this location")).toHaveCount(0);
|
await expect(page.getByText("A map draft exists for this location")).toHaveCount(0);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user