fix: prioritize map draft actions

This commit is contained in:
Nico 2026-06-03 14:43:06 -07:00
parent 18b11edba9
commit eb89c1f6fc
3 changed files with 45 additions and 15 deletions

View File

@ -73,9 +73,8 @@ export default function LocationMapBottomSheet({
}));
};
const editorActions = showEditorControls ? (
<div className="location-map-editor-action-stack" role="group" aria-label="Map draft actions">
<div className="location-map-editor-actions location-map-primary-actions">
<button type="button" onClick={onAddObject}>Add Area</button>
<button type="button" onClick={onPreviewDraft}>Preview Draft</button>
<button type="button" className="primary" onClick={onSaveDraft} disabled={saving || !hasUnsavedChanges}>Save Draft</button>
<button
type="button"
@ -85,9 +84,14 @@ export default function LocationMapBottomSheet({
>
Publish
</button>
</div>
<div className="location-map-editor-actions location-map-secondary-actions">
<button type="button" onClick={onAddObject}>Add Area</button>
<button type="button" onClick={onPreviewDraft} aria-label="Preview Draft">Preview</button>
<button type="button" onClick={onUndo} disabled={history.length === 0}>Undo</button>
<button type="button" onClick={onRedo} disabled={future.length === 0}>Redo</button>
</div>
</div>
) : canManage && mapState?.published_map ? (
<div className="location-map-editor-actions">
<button type="button" onClick={onEditMode}>Edit Map</button>

View File

@ -396,11 +396,25 @@
.location-map-editor-actions {
flex-wrap: wrap;
}
.location-map-editor-action-stack {
display: grid;
gap: 0.45rem;
margin-bottom: 0.75rem;
}
.location-map-primary-actions button {
flex: 1 1 96px;
flex: 1 1 140px;
}
.location-map-secondary-actions button {
flex: 1 1 82px;
min-height: 38px;
padding: 0.45rem 0.58rem;
background: rgba(21, 40, 59, 0.78);
color: #dbeafe;
font-size: 0.86rem;
}
.location-map-mobile-tool-switch {

View File

@ -882,6 +882,18 @@ test("mobile editor uses bottom sheet controls instead of desktop object toolbar
await expect(page.getByLabel("Map controls")).toBeVisible();
await expect(page.locator(".location-map-tool-buttons")).toBeHidden();
await expect(page.locator(".location-map-mobile-tool-switch")).toBeVisible();
const primaryActions = page.locator(".location-map-primary-actions");
const secondaryActions = page.locator(".location-map-secondary-actions");
await expect(primaryActions.getByRole("button", { name: "Save Draft" })).toBeVisible();
await expect(primaryActions.getByRole("button", { name: "Publish" })).toBeVisible();
await expect(secondaryActions.getByRole("button", { name: "Add Area" })).toBeVisible();
await expect(secondaryActions.getByRole("button", { name: "Preview Draft" })).toBeVisible();
const primaryActionBox = await primaryActions.boundingBox();
const secondaryActionBox = await secondaryActions.boundingBox();
expect(primaryActionBox).not.toBeNull();
expect(secondaryActionBox).not.toBeNull();
if (!primaryActionBox || !secondaryActionBox) throw new Error("Mobile action groups were not measurable");
expect(primaryActionBox.y).toBeLessThan(secondaryActionBox.y);
await expect(page.getByRole("button", { name: "Pan" })).toHaveClass(/active/);
await expect(page.getByRole("button", { name: "Pan" })).toHaveClass(/is-pan/);
await expect(page.getByRole("button", { name: "Objects" })).toHaveClass(/is-edit/);