Add store location map manager #20
@ -11,9 +11,7 @@ export default function LocationMapSetupPanel({
|
||||
onCreateBlank,
|
||||
}) {
|
||||
const hasZones = zoneCount > 0;
|
||||
const createFromZonesLabel = hasZones
|
||||
? `Create From ${zoneCount} Zone${zoneCount === 1 ? "" : "s"}`
|
||||
: "Create From Zones";
|
||||
const createFromZonesLabel = `Create From ${zoneCount} Zone${zoneCount === 1 ? "" : "s"}`;
|
||||
const createBlankLabel = savingAction === "create-blank" ? "Creating..." : "Create Blank Map";
|
||||
const createZonesButtonLabel = savingAction === "create-zones" ? "Creating..." : createFromZonesLabel;
|
||||
const publishLabel = savingAction === "publish" ? "Publishing..." : "Publish";
|
||||
@ -44,14 +42,9 @@ export default function LocationMapSetupPanel({
|
||||
) : !hasAnyMap && canManage ? (
|
||||
<div className="location-map-setup-actions">
|
||||
{!hasZones ? (
|
||||
<>
|
||||
<button type="button" className="btn-primary" onClick={onCreateBlank} disabled={saving}>
|
||||
{createBlankLabel}
|
||||
</button>
|
||||
<button type="button" className="btn-secondary" onClick={onCreateFromZones} disabled>
|
||||
{createFromZonesLabel}
|
||||
</button>
|
||||
</>
|
||||
<button type="button" className="btn-primary" onClick={onCreateBlank} disabled={saving}>
|
||||
{createBlankLabel}
|
||||
</button>
|
||||
) : (
|
||||
<>
|
||||
<button type="button" className="btn-primary" onClick={onCreateFromZones} disabled={saving}>
|
||||
|
||||
@ -440,14 +440,12 @@ test("admin setup uses compact status rows when no zones exist yet", async ({ pa
|
||||
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 From Zones" })).toHaveCount(0);
|
||||
await expect(page.getByRole("button", { name: "Create Blank Map" })).toBeEnabled();
|
||||
const blankButtonBox = await page.getByRole("button", { name: "Create Blank Map" }).boundingBox();
|
||||
const fromZonesButtonBox = await page.getByRole("button", { name: "Create From Zones" }).boundingBox();
|
||||
expect(blankButtonBox).not.toBeNull();
|
||||
expect(fromZonesButtonBox).not.toBeNull();
|
||||
if (!blankButtonBox || !fromZonesButtonBox) throw new Error("No-zone setup actions were not measurable");
|
||||
expect(blankButtonBox.y).toBeLessThan(fromZonesButtonBox.y);
|
||||
if (!blankButtonBox) throw new Error("No-zone setup action was not measurable");
|
||||
expect(blankButtonBox.height).toBeGreaterThanOrEqual(40);
|
||||
await expect(page.getByLabel("Map controls")).toHaveCount(0);
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user