Skip to content

feat(admin): admin UX modernisation — settings rebuild + shared scaffolding (NEWS-2152, NEWS-2168, NEWS-2263)#4707

Closed
thomasguillot wants to merge 5 commits into
trunkfrom
news-2152-bundled-mode-modal-parity
Closed

feat(admin): admin UX modernisation — settings rebuild + shared scaffolding (NEWS-2152, NEWS-2168, NEWS-2263)#4707
thomasguillot wants to merge 5 commits into
trunkfrom
news-2152-bundled-mode-modal-parity

Conversation

@thomasguillot
Copy link
Copy Markdown
Contributor

@thomasguillot thomasguillot commented May 7, 2026

Companion to Automattic/newspack-newsletters#2108 (NEWS-2152) and Automattic/newspack-newsletters#2110 (NEWS-2168).

Started as the wizard-bridge wiring for <SubscriptionLists> (NEWS-2152 / NEWS-2168) and grew to absorb the broader Newsletters Settings page rebuild and the shared scaffolding it needed (NEWS-2263 / admin UX modernisation milestone). Branch renamed from news-2152-bundled-mode-modal-parity to news-admin-ux-modernisation to reflect the broader scope.

NEWS-2152 / NEWS-2168 — Subscription-list bridge + ESP-edit parity

  • <SubscriptionLists> per-row Edit / Delete buttons dispatch wizard-bridge events instead of opening legacy URLs; reloads on save / delete.
  • Edit on remote rows goes through the bridge with kind: 'esp' (no audience picker, title + description only).
  • Active toggle commits per-row via PATCH /lists/{db_id}; bulk Save button retired.
  • 500 ms fallback timer routes to the legacy CPT editor when the bridge bundle is missing.

NEWS-2263 — Newsletters Settings page rebuild

Single-section wizard (fixedHeader, dirty tracking, unsaved-changes guard) with sections, top-to-bottom:

  • Email service provider — 2x2 brand-icon card grid (Active Campaign, Mailchimp, Constant Contact, Manual / Other). Selecting a card sets the provider and reveals its credentials below the grid. OAuth Authorize prompt inlines for Constant Contact.
  • Newsletter posts — slug, comments, related-posts as ToggleControls.
  • Subscription lists — per-row ToggleControl with Local / ESP badge, list description as help text, divider between rows, Edit / Delete on the right (Delete only for local lists). Below the list, a paragraph + secondary "Add new local list" button explain provider-specific syncing (label resolved per-ESP via the wizard's settings response).
  • Ads tracking — merged in from the previous separate tab; ToggleControls for click + impressions. Tracking tab removed from the ads-list admin header since the section now lives in Settings.
  • Letterhead — separate section at the bottom for the Letterhead API key + help link.

PHP: wizard /settings response now includes the active provider's labels (get_labels('local_list_explanation')), guarded with class_exists for standalone-newspack-plugin installs.

Shared scaffolding (packages/components)

  • integration-icons namespace with 6 brand SVGs (Active Campaign, Constant Contact, Fundraise Up, Mailchimp, Salesforce, Wisepops); fills customisable via var(--integration-icon-color) / --integration-icon-color-accent with brand-colour defaults.
  • useUnsavedChangesDialog hook — wraps useConfirmDialog with the standard "discard changes" messaging, intercepts outbound link clicks so the custom dialog fires instead of the silent native one, plus a beforeunload safety net.
  • CardSettingsGroup gains optional className and iconSize props.
  • CoreCard accepts iconSize; SCSS reads it via the new --newspack-card-icon-size custom property with fallback to existing defaults (no consumer changes required).
  • SectionHeader — container margin now zeroes alongside its inner element when noMargin is set (via :has() so callsites need no change).
  • admin.css — chrome section header only gets margin-top when it's not the first child of newspack-wizard__content, fixing the doubled spacing on audience /edit/new/all.
  • Audience content-gates edit adopts useUnsavedChangesDialog so the same standardised confirm flow covers both wizards.

Test plan

  • Run paired newspack-newsletters branches (NEWS-2152 already merged into the epic; NEWS-2168 on news-2168-revisit-esp-subscription-list-edit-flow-standalone).
  • Smoke-test Add / Edit / Delete on a Mailchimp + Constant Contact dev site for both local and remote rows.
  • Verify the bottom Save Subscription Lists button is gone and the active toggle on a remote row persists across reloads.
  • Disable newspack-newsletters bundle JS to confirm the fallback timer redirects to the legacy URL on Edit.
  • Newsletters Settings: pick each ESP card, verify its credential fields appear; toggle settings; click Save; confirm the unsaved-changes guard fires on navigation away with a dirty form.
  • Audience access control /edit/new/all: confirm the chrome section header sits flush with the wizard content padding (no doubled top margin) and the discard-changes dialog still fires via the shared hook.

Merge order

Merge the newspack-newsletters branches first; this PR follows.

The `bridgeMounted` flag was only set via the one-shot
`newspack-newsletters:bridge-mounted` event listener. If the bridge bundle
booted before this module evaluated, the event was missed and the 500ms
fallback timer redirected to the legacy editor after every modal-open
attempt. Replace the local mutable boolean with a sync read of
`window.newspackNewslettersBridgeReady`, which the bridge now sets before
dispatching the event.

Refs NEWS-2152
…2168)

Stacks the bundled-mode side onto the same wiring as NEWS-2152's
local-list parity. The wizard's SubscriptionLists view dispatches
OPEN_MODAL with kind='esp' for remote rows (replacing the legacy
ExternalLink to the CPT editor) and the active toggle commits
immediately via PATCH /lists/{db_id}.

- Edit on remote rows opens the same modal in ESP mode through the
  wizard-bridge (legacy edit_link still serves as the fallback when
  the bridge isn't ready).
- Inline TextControl/TextareaControl pair removed for remote rows —
  the modal owns title + description.
- Active toggle on every row PATCHes that one row; bulk
  "Save Subscription Lists" button removed.
- Description string surfaced under the bold ActionCard title (with
  the type label kept on a smaller line below) so publishers see what
  customisation is in place without opening the modal.
@thomasguillot thomasguillot changed the title feat(newsletters): bundled-mode parity for local-list modal (NEWS-2152) feat(newsletters): bundled-mode parity for subscription-list modal (NEWS-2152, NEWS-2168) May 7, 2026
@thomasguillot thomasguillot deleted the news-2152-bundled-mode-modal-parity branch May 18, 2026 13:26
@thomasguillot thomasguillot changed the title feat(newsletters): bundled-mode parity for subscription-list modal (NEWS-2152, NEWS-2168) feat(admin): admin UX modernisation — settings rebuild + shared scaffolding (NEWS-2152, NEWS-2168, NEWS-2263) May 18, 2026
@thomasguillot
Copy link
Copy Markdown
Contributor Author

Branch was renamed from news-2152-bundled-mode-modal-parity to news-admin-ux-modernisation to reflect the broader scope. GitHub's rename endpoint didn't transitively update this PR's head_ref so it auto-closed. Continued in #4735.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant