Skip to content

consolidate admin save UI into one StatusDropdown

jedmund requested to merge jedmund/admin-save-ui into main

Created by: jedmund

Summary

  • redesigns StatusDropdown around a single status prop + onSave(target) callback. labels and the alt action are derived internally from a DEFAULTS map keyed on status, so they always update together — no more split-prop arrival race that caused the "Save as Draft button flickers but doesn't change" bug on the post edit page
  • updates all callers (post edit, ProjectForm, GardenItemForm, post new) to the new API
  • replaces PublishDropdown on /admin/posts/new with StatusDropdown, so the new-post UI now reactively reflects status after saving as draft (was previously stuck on "Publish")
  • deletes the unused PublishDropdown.svelte and SaveActionsGroup.svelte
  • ProjectForm keeps its non-standard statuses (list-only, password-protected) working via the new optional primaryLabel / altActions overrides

This is PR 1 of 3 in a planned admin save-flow refactor. PR 2 will unify posts/new and posts/[id]/edit into a single PostForm component; PR 3 will swap the remaining goto-after-save patterns in Project/Garden/Album forms for replaceState.

Test plan

  • /admin/posts/[id]/edit for a published post: open dropdown → "Move to draft" → primary button label updates to "Save draft" cleanly without flicker, and stays
  • same flow with a draft post → "Publish" → label updates to "Save changes"
  • /admin/posts/new: primary saves draft, alt publishes; after save the URL silently swaps to /admin/posts/[id]/edit (existing behavior) and the button label reflects the new status
  • project edit page (incl. list-only / password-protected): dropdown still offers Publish + Save as draft alt actions
  • garden item edit: status transitions still work
  • pnpm run check clean for changed files (preexisting ProjectForm errors unchanged)

Merge request reports

Loading