consolidate admin save UI into one StatusDropdown
Created by: jedmund
Summary
- redesigns
StatusDropdownaround a singlestatusprop +onSave(target)callback. labels and the alt action are derived internally from aDEFAULTSmap 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
PublishDropdownon/admin/posts/newwithStatusDropdown, so the new-post UI now reactively reflects status after saving as draft (was previously stuck on "Publish") - deletes the unused
PublishDropdown.svelteandSaveActionsGroup.svelte - ProjectForm keeps its non-standard statuses (
list-only,password-protected) working via the new optionalprimaryLabel/altActionsoverrides
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]/editfor 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 checkclean for changed files (preexisting ProjectForm errors unchanged)