Skip to content

Foundation + Color tab fully wired #838

@bph

Description

@bph

Part of #836. First feature PR after the endpoint lands. Wires the modal's Color tab end-to-end so users can persist palette / gradient / duotone / default-toggle changes to theme.json. Other tabs continue rendering but their Update is a no-op until subsequent PRs.

Depends on #837.

Scope

Files

  • src/resolvers.js — add postUpdateThemeSettings(payload) mirroring postUpdateThemeMetadata.
  • src/editor-sidebar/edit-theme-settings-modal.js — lift Color-tab state to modal level, wire handleUpdateClick to call the resolver, add loading / success-notice / error-notice / refresh.
  • src/plugin-styles.scss — any save-state styling adjustments (loading indicator on the footer button).

Behavior

  • Update button enabled when there are pending changes; disabled + spinner during save.
  • Success: surface createSuccessNotice, refresh the theme entity record (panels' useEffect resets local state from new server data automatically). Modal stays open by default.
  • Error: surface createErrorNotice with the WP_Error message.

State lifting

Modal owns:

  • colorSettings (defaults flags + custom flags + link)
  • palette / gradients / duotone arrays

Passed to ColorSettingsPanel / PalettePanel / GradientPanel / DuotonePanel as value + onChange. Tabs other than Color keep their existing local state for now.

Acceptance criteria

  • Edit any Color sub-panel value, click Update — value persists to theme.json on disk.
  • Reload editor — change is reflected.
  • Failure (e.g. 500) surfaces an error notice; modal stays open.
  • Update button shows loading state during save and is disabled when there are no pending changes.
  • Other tabs (Dimensions / Typography / Shadows / Templates) still render and do not error.
  • e2e smoke test for the Color save path (if e2e infra is in place per Add basic e2e tests #811).

Out of scope

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions