Skip to content

feat(marketing-pipeline): persist rewrite workflow state and add rewr…#246

Merged
rafchen merged 3 commits into
feature/marketing-pipelinefrom
junzhe-marketing-pipeline-frontend-refinment
Mar 10, 2026
Merged

feat(marketing-pipeline): persist rewrite workflow state and add rewr…#246
rafchen merged 3 commits into
feature/marketing-pipelinefrom
junzhe-marketing-pipeline-frontend-refinment

Conversation

@JunzheShi0702
Copy link
Copy Markdown
Collaborator

Summary

This PR refines the Marketing Pipeline -> Rewrite flow and improves persistence, handoff, and UX consistency.

What changed

  • Added per-session persistence for Rewrite sidebar workflow state in Marketing Pipeline:
    • prompt text
    • rewrite options (tone/length/audience/custom prompt)
    • current workflow step
    • draft mode toggle
    • rewritten preview content
  • Added explicit Push to Rewrite Document action from Marketing Pipeline.
  • Added session-storage handoff (pdr.pendingRewriteDraft) and route handoff to documents rewrite mode.
  • Added query-trigger handling in documents shell for view=rewrite.
  • Added pending-draft consumption in Rewrite document view to open editor prefilled with generated content.
  • Enhanced Rewrite workflow with Draft Mode:
    • ON: show draft preview and allow regenerate/push
    • OFF: directly complete into rewrite document path
  • Updated Rewrite preview panel rendering to use markdown renderer (MarkdownMessage) and aligned button labels.
  • Added/updated marketing pipeline session history UX:
    • left sidebar sessions list
    • active session restore/switch
    • persisted sessions in sessionStorage
    • new-session behavior updates
  • Fixed duplicate key risk in trend references.
  • Fixed profile dropdown hydration mismatch by mount-guarding UserButton.
  • Updated tests for Rewrite preview labels + markdown behavior; added markdown/Jest mocks for ESM compatibility.

Files touched

  • src/app/employer/tools/marketing-pipeline/page.tsx
  • src/styles/Employer/MarketingPipeline.module.css
  • src/app/employer/documents/components/generator/RewriteWorkflow.tsx
  • src/app/employer/documents/components/generator/RewritePreviewPanel.tsx
  • src/app/employer/documents/components/DocumentViewerShell.tsx
  • src/app/employer/documents/components/RewriteDiffView.tsx
  • src/app/employer/_components/ProfileDropdown.tsx
  • __tests__/components/RewritePreviewPanel.test.tsx

Why

These changes make rewrite refinement resilient across sidebar open/close cycles and session switches, while enabling a clearer path to push generated campaigns into the dedicated Rewrite document experience.

Validation

  • TypeScript/editor diagnostics passed for updated files.
  • Rewrite preview tests updated and aligned with new labels/markdown behavior.

Notes

  • Branch: junzhe-marketing-pipeline-frontend-refinment
  • Commit: 6735b35f644d1c1bd192131dc6cb9ec8a6703608

…ite handoff UX

Implement end-to-end rewrite refinement flow improvements across marketing pipeline and documents modules.

Key updates:

- Preserve rewrite sidebar workflow state per marketing session (prompt text, tone/length/audience options, custom prompt, current step, draft mode, and rewritten preview) so close/reopen keeps user progress.

- Add explicit 'Push to Rewrite Document' action from Marketing Pipeline, storing pending draft in sessionStorage and navigating to documents rewrite mode.

- Support documents page query handoff () and consume pending draft in RewriteDiffView to open prefilled editor content.

- Enhance RewriteWorkflow with Draft Mode toggle: ON keeps in-sheet preview/regenerate flow; OFF directly opens rewrite document path via completion callback.

- Update rewrite preview rendering to use MarkdownMessage for markdown formatting fidelity and align action labels ('Regenerate', 'Push to Rewrite').

- Expand marketing pipeline session history UX (left sidebar sessions list, active session switching, persisted sessions in sessionStorage, new-session behavior).

- Fix duplicate React key risk in trend references by adding index in composite key.

- Fix hydration mismatch in ProfileDropdown by guarding UserButton render until mount.

- Update RewritePreviewPanel tests for new labels and markdown behavior; add markdown-related jest mocks for ESM compatibility.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pdr-ai-v2 Ready Ready Preview, Comment Mar 10, 2026 0:03am

@rafchen rafchen merged commit 208cb32 into feature/marketing-pipeline Mar 10, 2026
3 of 4 checks passed
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.

2 participants