Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TWilson023
Copy link
Collaborator

@TWilson023 TWilson023 commented Dec 11, 2025

Quick implementation of sticky rich text toolbar:
Screenshot 2025-12-11 at 5 05 50 PM

...and changes to make rendered email line heights match the campaign editor.

Summary by CodeRabbit

  • New Features

    • Campaign editor toolbar is now sticky with adjusted spacing, keeping formatting controls visible while scrolling.
  • Bug Fixes

    • Improved campaign email rendering: overall body line spacing increased for readability and list item line-height handling refined for better display.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Dec 11, 2025

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

Project Deployment Preview Updated (UTC)
dub Ready Ready Preview Dec 11, 2025 10:13pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 11, 2025

Walkthrough

Updated RichText editor layout in the campaign editor to add a sticky toolbar with adjusted spacing; changed email HTML post-processing and template styles to remove list item line-height and add a container line-height for rendered campaign HTML.

Changes

Cohort / File(s) Summary
Campaign Editor UI Layout
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/[campaignId]/campaign-editor.tsx
Replaced the vertical wrapper around RichTextToolbar/RichTextArea with a sticky header wrapper: added white background, gradient spacer, higher z-index, and reduced top margin (mt-6mt-4). No data-flow or editing logic changes.
Email rendering & template
apps/web/lib/api/workflows/render-campaign-email-html.ts, packages/email/src/templates/campaign-email.tsx
Removed line-height: 1 from inline styles applied to <li> elements during HTML post-processing; added lineHeight: 1.7142857 to the div that renders campaign HTML in the email template. No control-flow changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review UI markup for correct sticky behavior and z-index stacking in campaign-editor.tsx.
  • Verify email HTML post-processing didn't unintentionally alter list rendering across clients in render-campaign-email-html.ts.
  • Confirm the template lineHeight change in packages/email/src/templates/campaign-email.tsx aligns with rendered output.

Possibly related PRs

Suggested reviewers

  • steven-tey

Poem

🐰
A sticky toolbar hums on high,
Spacing trimmed to please the eye,
Lists breathe freer, lines align,
Campaigns look snug and fine—
I hop away, content and spry. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: a sticky campaign toolbar UI enhancement and line height adjustments to rendered emails for consistency.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sticky-campaign-toolbar

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f0eb0e and 40bda8d.

📒 Files selected for processing (1)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/[campaignId]/campaign-editor.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/[campaignId]/campaign-editor.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
apps/web/lib/api/workflows/render-campaign-email-html.ts (1)

65-67: List item line-height change aligns with new global body line height

Dropping line-height: 1 from the <li> inline style lets list items inherit the container’s line height (now set on the HTML wrapper), which matches the PR goal of making rendered emails look like the editor. The existing regex-based style override behavior is unchanged and acceptable for this PR.

If you later revisit this pipeline, it may be worth switching from blind regex replacement to something that merges with existing style attributes more robustly, but that’s not necessary to land this change.

packages/email/src/templates/campaign-email.tsx (1)

77-81: Body line-height choice looks intentional; consider de‑duplicating the magic number

Setting lineHeight: 1.7142857 on the wrapper (24px for 14px text) makes rendered email copy consistent and, together with the removed line-height on <li>, should align list and paragraph spacing with the editor.

If this value is meant to track the editor’s line-height, consider extracting it to a shared constant or adding a short comment so future tweaks don’t accidentally desync editor vs. email rendering.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/[campaignId]/campaign-editor.tsx (1)

555-563: Sticky toolbar wrapper looks sound; background tokens are an optional polish

The new wrapper + sticky header structure should give you the desired pinned toolbar with a clean white backdrop and gradient separator without affecting editor behavior. Z‑index and spacing choices look reasonable for the existing layout.

If you anticipate theme variations, consider swapping bg-white / from-white for a semantic background token from @dub/ui so the toolbar background stays in sync with the rest of the page, but it’s fine as is for a white email canvas.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 06df8a3 and 5f0eb0e.

📒 Files selected for processing (3)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/[campaignId]/campaign-editor.tsx (1 hunks)
  • apps/web/lib/api/workflows/render-campaign-email-html.ts (1 hunks)
  • packages/email/src/templates/campaign-email.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: TWilson023
Repo: dubinc/dub PR: 2872
File: apps/web/app/(ee)/partners.dub.co/(dashboard)/profile/profile-details-form.tsx:180-189
Timestamp: 2025-09-24T15:50:16.414Z
Learning: TWilson023 prefers to keep security vulnerability fixes separate from refactoring PRs when the vulnerable code is existing and was only moved/relocated rather than newly introduced.
📚 Learning: 2025-10-15T01:05:43.266Z
Learnt from: steven-tey
Repo: dubinc/dub PR: 2958
File: apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx:432-457
Timestamp: 2025-10-15T01:05:43.266Z
Learning: In apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx, defer refactoring the custom MenuItem component (lines 432-457) to use the shared dub/ui MenuItem component to a future PR, as requested by steven-tey.

Applied to files:

  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/[campaignId]/campaign-editor.tsx
🧬 Code graph analysis (1)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/[campaignId]/campaign-editor.tsx (1)
packages/ui/src/rich-text-area/rich-text-toolbar.tsx (1)
  • RichTextToolbar (16-129)
🪛 ast-grep (0.40.0)
packages/email/src/templates/campaign-email.tsx

[warning] 79-79: Usage of dangerouslySetInnerHTML detected. This bypasses React's built-in XSS protection. Always sanitize HTML content using libraries like DOMPurify before injecting it into the DOM to prevent XSS attacks.
Context: dangerouslySetInnerHTML
Note: [CWE-79] Improper Neutralization of Input During Web Page Generation [REFERENCES]
- https://reactjs.org/docs/dom-elements.html#dangerouslysetinnerhtml
- https://cwe.mitre.org/data/definitions/79.html

(react-unsafe-html-injection)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build

@steven-tey steven-tey merged commit f61a087 into main Dec 11, 2025
7 of 8 checks passed
@steven-tey steven-tey deleted the sticky-campaign-toolbar branch December 11, 2025 22:43
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.

3 participants