fix: clarify draft view action

This commit is contained in:
Nico 2026-06-04 19:41:52 -07:00
parent 0c8f18e1e5
commit e5927a4811
3 changed files with 12 additions and 12 deletions

View File

@ -179,8 +179,8 @@ export default function LocationMapBottomSheet({
<div className="location-map-editor-actions location-map-secondary-actions"> <div className="location-map-editor-actions location-map-secondary-actions">
<button type="button" onClick={onAddObject} disabled={saving}>Add Area</button> <button type="button" onClick={onAddObject} disabled={saving}>Add Area</button>
{showPreviewDraftAction ? ( {showPreviewDraftAction ? (
<button type="button" onClick={onPreviewDraft} aria-label="Preview Draft" disabled={saving}> <button type="button" onClick={onPreviewDraft} disabled={saving}>
Preview View Draft
</button> </button>
) : null} ) : null}
</div> </div>

View File

@ -33,7 +33,7 @@ export default function LocationMapSetupPanel({
Continue Editing Continue Editing
</button> </button>
<button type="button" className="btn-secondary" onClick={onPreview} disabled={saving}> <button type="button" className="btn-secondary" onClick={onPreview} disabled={saving}>
Preview Draft View Draft
</button> </button>
<button type="button" className="btn-primary" onClick={onPublish} disabled={saving || !canManage}> <button type="button" className="btn-primary" onClick={onPublish} disabled={saving || !canManage}>
{publishLabel} {publishLabel}

View File

@ -361,7 +361,7 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({
await expect(page).toHaveURL(/\/stores\/100\/locations\/10\/map$/); await expect(page).toHaveURL(/\/stores\/100\/locations\/10\/map$/);
await expect(page.locator(".location-map-status")).toHaveText("Unsaved Draft"); await expect(page.locator(".location-map-status")).toHaveText("Unsaved Draft");
await page.getByRole("button", { name: "Preview Draft" }).click(); await page.getByRole("button", { name: "View Draft" }).click();
await expect(page.locator(".location-map-object", { hasText: "Bread Wall" })).toBeVisible(); await expect(page.locator(".location-map-object", { hasText: "Bread Wall" })).toBeVisible();
await expect(page.locator(".location-map-status")).toHaveText("Unsaved Draft"); await expect(page.locator(".location-map-status")).toHaveText("Unsaved Draft");
@ -387,7 +387,7 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({
await page.goto("/stores/100/locations/10/map"); await page.goto("/stores/100/locations/10/map");
await expect(page.locator(".location-map-status")).toHaveText("Draft"); await expect(page.locator(".location-map-status")).toHaveText("Draft");
await expect(page.getByRole("heading", { name: "Draft Map" })).toBeVisible(); await expect(page.getByRole("heading", { name: "Draft Map" })).toBeVisible();
await expect(page.getByRole("button", { name: "Preview Draft" })).toBeVisible(); await expect(page.getByRole("button", { name: "View Draft" })).toBeVisible();
await expect(page.getByRole("button", { name: "Publish", exact: true })).toBeVisible(); await expect(page.getByRole("button", { name: "Publish", exact: true })).toBeVisible();
await expect(page.getByRole("button", { name: "Preview Map" })).toHaveCount(0); await expect(page.getByRole("button", { name: "Preview Map" })).toHaveCount(0);
await expect(page.getByRole("button", { name: "Publish Map" })).toHaveCount(0); await expect(page.getByRole("button", { name: "Publish Map" })).toHaveCount(0);
@ -1220,7 +1220,7 @@ test("admin status follows the visible map when a saved draft exists", async ({
await expect(page.locator(".location-map-status")).toHaveText("Draft"); await expect(page.locator(".location-map-status")).toHaveText("Draft");
await expect(page.locator(".location-map-object", { hasText: "Draft Bakery" })).toBeVisible(); await expect(page.locator(".location-map-object", { hasText: "Draft Bakery" })).toBeVisible();
await page.getByRole("button", { name: "Preview Draft" }).click(); await page.getByRole("button", { name: "View Draft" }).click();
await expect(page.locator(".location-map-status")).toHaveText("Draft Preview"); await expect(page.locator(".location-map-status")).toHaveText("Draft Preview");
await expect(page.locator(".location-map-object", { hasText: "Draft Bakery" })).toBeVisible(); await expect(page.locator(".location-map-object", { hasText: "Draft Bakery" })).toBeVisible();
@ -1265,7 +1265,7 @@ test("admin edit mode hides unavailable draft actions until changes exist", asyn
const secondaryActions = page.locator(".location-map-secondary-actions"); const secondaryActions = page.locator(".location-map-secondary-actions");
await expect(page.locator(".location-map-primary-actions")).toHaveCount(0); await expect(page.locator(".location-map-primary-actions")).toHaveCount(0);
await expect(secondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible(); await expect(secondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible();
await expect(secondaryActions.getByRole("button", { name: "Preview Draft" })).toHaveCount(0); await expect(secondaryActions.getByRole("button", { name: "View Draft" })).toHaveCount(0);
await expect(page.getByRole("button", { name: "Save Draft" })).toHaveCount(0); await expect(page.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
await expect(page.getByRole("button", { name: "Publish", exact: true })).toHaveCount(0); await expect(page.getByRole("button", { name: "Publish", exact: true })).toHaveCount(0);
@ -1338,7 +1338,7 @@ test("mode switches close open map layers without resetting filters", async ({ p
await page.getByRole("button", { name: "Edit Draft" }).click(); await page.getByRole("button", { name: "Edit Draft" }).click();
await page.getByRole("button", { name: "Layers, 1 changed" }).click(); await page.getByRole("button", { name: "Layers, 1 changed" }).click();
await expect(page.locator(".location-map-display-panel")).toBeVisible(); await expect(page.locator(".location-map-display-panel")).toBeVisible();
await page.getByRole("button", { name: "Preview Draft" }).click(); await page.getByRole("button", { name: "View Draft" }).click();
await expect(page.getByRole("button", { name: "Layers, 1 changed" })).toHaveAttribute("aria-expanded", "false"); await expect(page.getByRole("button", { name: "Layers, 1 changed" })).toHaveAttribute("aria-expanded", "false");
await expect(page.locator(".location-map-display-panel")).toHaveCount(0); await expect(page.locator(".location-map-display-panel")).toHaveCount(0);
@ -1387,7 +1387,7 @@ test("mobile keeps draft preview status compact in the topbar", async ({ page })
await page.goto("/stores/100/locations/10/map"); await page.goto("/stores/100/locations/10/map");
await page.getByRole("button", { name: "Edit Draft" }).click(); await page.getByRole("button", { name: "Edit Draft" }).click();
await page.getByRole("button", { name: "Preview Draft" }).click(); await page.getByRole("button", { name: "View Draft" }).click();
const topbar = page.locator(".location-map-topbar"); const topbar = page.locator(".location-map-topbar");
const backButton = page.getByRole("button", { name: "Back to grocery list" }); const backButton = page.getByRole("button", { name: "Back to grocery list" });
@ -2137,7 +2137,7 @@ test("admin save progress locks draft controls", async ({ page }) => {
await expect(page.getByRole("button", { name: "Saving..." })).toBeDisabled(); await expect(page.getByRole("button", { name: "Saving..." })).toBeDisabled();
await expect(page.getByRole("button", { name: "Publish" })).toBeDisabled(); await expect(page.getByRole("button", { name: "Publish" })).toBeDisabled();
await expect(page.getByRole("button", { name: "Add Area" })).toBeDisabled(); await expect(page.getByRole("button", { name: "Add Area" })).toBeDisabled();
await expect(page.getByRole("button", { name: "Preview Draft" })).toHaveCount(0); await expect(page.getByRole("button", { name: "View Draft" })).toHaveCount(0);
await expect(page.getByRole("button", { name: "Undo" })).toBeDisabled(); await expect(page.getByRole("button", { name: "Undo" })).toBeDisabled();
await expect(page.getByRole("button", { name: "Duplicate" })).toBeDisabled(); await expect(page.getByRole("button", { name: "Duplicate" })).toBeDisabled();
await expect(page.getByRole("button", { name: "Delete" })).toBeDisabled(); await expect(page.getByRole("button", { name: "Delete" })).toBeDisabled();
@ -4007,7 +4007,7 @@ test("mobile editor uses bottom sheet controls instead of desktop object toolbar
await expect(primaryActions.getByRole("button", { name: "Save Draft" })).toHaveCount(0); await expect(primaryActions.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
await expect(primaryActions.getByRole("button", { name: "Publish" })).toBeVisible(); await expect(primaryActions.getByRole("button", { name: "Publish" })).toBeVisible();
await expect(secondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible(); await expect(secondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible();
await expect(secondaryActions.getByRole("button", { name: "Preview Draft" })).toBeVisible(); await expect(secondaryActions.getByRole("button", { name: "View Draft" })).toBeVisible();
const primaryActionBox = await primaryActions.boundingBox(); const primaryActionBox = await primaryActions.boundingBox();
const secondaryActionBox = await secondaryActions.boundingBox(); const secondaryActionBox = await secondaryActions.boundingBox();
expect(primaryActionBox).not.toBeNull(); expect(primaryActionBox).not.toBeNull();
@ -4067,7 +4067,7 @@ test("mobile editor uses bottom sheet controls instead of desktop object toolbar
await expect(selectedPrimaryActions.getByRole("button", { name: "Save Draft" })).toHaveCount(0); await expect(selectedPrimaryActions.getByRole("button", { name: "Save Draft" })).toHaveCount(0);
await expect(selectedPrimaryActions.getByRole("button", { name: "Publish" })).toBeVisible(); await expect(selectedPrimaryActions.getByRole("button", { name: "Publish" })).toBeVisible();
await expect(selectedSecondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible(); await expect(selectedSecondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible();
await expect(selectedSecondaryActions.getByRole("button", { name: "Preview Draft" })).toHaveCount(0); await expect(selectedSecondaryActions.getByRole("button", { name: "View Draft" })).toHaveCount(0);
await expect(page.getByRole("button", { name: "Bought" })).toHaveCount(0); await expect(page.getByRole("button", { name: "Bought" })).toHaveCount(0);
const selectedPrimaryBox = await selectedPrimaryActions.boundingBox(); const selectedPrimaryBox = await selectedPrimaryActions.boundingBox();
const selectedSecondaryButtonBox = await selectedSecondaryActions.getByRole("button", { name: "Add Area" }).boundingBox(); const selectedSecondaryButtonBox = await selectedSecondaryActions.getByRole("button", { name: "Add Area" }).boundingBox();