Skip to content

Tidy note toolbar and move PDF title into a page footer - #97

Merged
ddutchie merged 4 commits into
mainfrom
ddutchie/pdfnotefixes
Jul 25, 2026
Merged

ddutchie merged 4 commits into
mainfrom
ddutchie/pdfnotefixes

Conversation

@ddutchie

@ddutchie ddutchie commented Jul 25, 2026 •

Copy link
Copy Markdown
Owner

What does this PR do?

Tidies the note-view toolbar and reworks PDF export. The word count / reading time moves below the note title, the toolbar actions are regrouped so they stay legible when the notes pane is narrow, and desktop PDF exports now show the note title in a running page footer (title left, page number right) instead of a large title banner.

Type of change

  • Bug fix
  • New feature
  • Refactor / code quality
  • Docs / changelog
  • Tests

Screenshots / recording

  • Word count now sits under the title next to the tags.
  • Pin / similar-notes / distraction-free icons are clustered; Spawn tasks / PDF / timestamp no longer wrap mid-word at narrow widths.
  • PDF pages carry a small footer: note title (left) · page / total (right).

Checklist

  • npm run type-check:all passes
  • npm run lint passes
  • npm test passes (runs npm run compile first so electron/bundle-guard.test.ts actually executes — npm run test:bundle to run just that)
  • npm run test:e2e passes (run before merging UI changes or cutting a release)
  • If this ships a major, user-facing feature: N/A — incremental UI/PDF change, recorded in changelogs/v2.5.9.md
  • No hardcoded colours — CSS variables only (var(--accent), var(--text-primary), etc.)
  • No text-[Npx] pixel font classes — rem equivalents only (text-[0.714rem], text-xs, etc.)
  • New IPC handlers wrapped in handle() and return IpcResult<T> — N/A (no new handlers; existing app:exportNotePdf unchanged in shape)
  • New DB migrations appended (not edited) in schema.ts — N/A
  • New SQL goes in electron/db/queries.ts — N/A
  • New dependencies or devDependencies — N/A
  • New MCP tools registered — N/A
  • --external:<pkg> flag change — N/A

Notes for reviewer

  • Desktop PDF now uses printToPDF's displayHeaderFooter for the footer (title + page numbers) — CSS @page counters aren't reliable under printToPDF, hence the native footer template. Margins switched from default to explicit custom values to leave room for the footer.
  • buildPdfHtml gains a titleMode param ("heading" | "none", default "heading"). Desktop passes "none"; mobile keeps "heading" because expo-print can't render Chromium running footers.
  • Toolbar change is CSS/layout only — the word count element was relocated below the title and text items got whitespace-nowrap; icon buttons wrapped in a single flex cluster.

Summary by CodeRabbit

  • New Features

    • PDF exports now display the note title in a running footer with page numbers.
    • PDF exports support light and dark theme footer styling.
  • UI Improvements

    • Note metadata now appears below the title for a cleaner layout.
    • Toolbar actions remain aligned and readable in narrow panes.
    • Mobile PDF export behavior remains unchanged.
  • Bug Fixes

    • Prevented toolbar labels and metadata from wrapping unexpectedly.
    • Improved escaping of special characters in PDF footer titles.

Move the word count / reading time below the note title and regroup the
toolbar actions (clustered icon buttons, no mid-word text wrapping) so the
bar stays legible when the notes pane is narrow.

Desktop PDF export now renders the note title in a running page footer
(title left, page number right) instead of a large title banner, using
printToPDF's displayHeaderFooter. buildPdfHtml gains a titleMode param;
mobile keeps a compact heading since expo-print can't do running footers.
@coderabbitai

coderabbitai Bot commented Jul 25, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ddutchie, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 7 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7648ecde-7cd5-4110-b0bf-fb2dd537b8e2

📥 Commits

Reviewing files that changed from the base of the PR and between cb9a953 and 40a8175.

📒 Files selected for processing (12)
  • changelogs/v2.5.9.md
  • electron/db/queries.test.ts
  • electron/db/queries.ts
  • electron/ipc/db-handlers.ts
  • electron/preload.ts
  • scripts/features.config.js
  • shared/notes/pdf-template.test.ts
  • shared/notes/pdf-template.ts
  • src/components/layout/sidebar.tsx
  • src/lib/commands/card-commands.ts
  • src/store/slices/board.ts
  • src/store/slices/workspace.ts
📝 Walkthrough

Walkthrough

The note toolbar layout now prevents wrapping and places reading metadata below the title. Desktop PDF exports use running title/page footers, while mobile retains a compact heading.

Changes

PDF export footer flow

Layer / File(s) Summary
PDF template behavior and validation
shared/notes/pdf-template.ts, shared/notes/pdf-template.test.ts, electron/lib/pdf-template.ts
buildPdfHtml supports title-free bodies, while new themed header/footer builders provide escaped titles and page-number placeholders with test coverage.
Electron PDF print integration
electron/ipc/pdf-export.ts, changelogs/v2.5.9.md
Desktop PDF printing enables header/footer templates, explicit margins, and title-free HTML; the changelog records the resulting footer behavior.

Note toolbar layout

Layer / File(s) Summary
Toolbar and metadata layout
src/components/notes/note-editor.tsx, changelogs/v2.5.9.md
Toolbar labels and metadata use non-wrapping flex layout, and word-count/read-time text is centered below the title.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PDFIPC as Electron PDF IPC handler
  participant Templates as PDF template builders
  participant Chromium as Chromium printToPDF
  PDFIPC->>Templates: Build title-free HTML
  PDFIPC->>Templates: Build header and footer templates
  PDFIPC->>Chromium: Print with custom margins and displayHeaderFooter
  Chromium-->>PDFIPC: Return generated PDF
Loading

Possibly related PRs

  • ddutchie/cairn#55: Modifies the Electron PDF export and shared PDF template pipeline.
  • ddutchie/cairn#87: Extends the existing shared PDF template and mobile/desktop export paths.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main UI cleanup and PDF footer change in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ddutchie/pdfnotefixes

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@shared/notes/pdf-template.ts`:
- Around line 215-222: Update the footer container markup returned by
buildPdfFooterTemplate to use border-box sizing so its 100% width includes the
horizontal 2.2cm padding. Preserve the existing layout, styling, and page-number
alignment.
- Around line 194-203: Centralize an HTML text-context escaping helper in the
PDF template module that escapes ampersands along with angle brackets (and other
required text-context characters). Replace the existing document title escaping
near the document `<title>` and the inline `.pdf-title` escaping in the
`titleMode === "heading"` branch with this shared helper, preserving the current
title rendering behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dbf9fa8d-6372-470c-93ea-918988004879

📥 Commits

Reviewing files that changed from the base of the PR and between b173f3c and cb9a953.

📒 Files selected for processing (6)
  • changelogs/v2.5.9.md
  • electron/ipc/pdf-export.ts
  • electron/lib/pdf-template.ts
  • shared/notes/pdf-template.test.ts
  • shared/notes/pdf-template.ts
  • src/components/notes/note-editor.tsx

Comment thread shared/notes/pdf-template.ts
Comment thread shared/notes/pdf-template.ts
ddutchie added 3 commits July 25, 2026 12:56
Add a 'Merge into…' action to each project's sidebar menu that moves all
notes, tasks, board columns, and Idea Flow nodes into a chosen destination
project, then deletes the emptied source.

- q.mergeProject: one transaction repointing notes/cards/columns/idea-flow
  plus the FK-less chat_threads/tool_attachments/pi_agent_sessions that a bare
  project delete would orphan. Cards map into the destination's same-type
  column; custom columns are recreated. Uses direct SET for project_id so the
  move actually persists (updateCard/updateNote COALESCE lists omit it).
- db:project:merge IPC handler relocates each moved note's .md into the target
  folder, removes the source folder, and reconciles as a self-heal.
- project.merge preload binding + mergeProject store action (re-hydrates).
- Merge dialog uses the standard DropdownMenu picker (not a native select).
- Unit tests + changelog + What's New entry.
- Centralize an escapeHtmlText() helper (escapes & first, then < and >) and
  use it for the document <title>, the in-body heading, and the footer title,
  so text-context escaping is consistent — the title/heading previously escaped
  only < and dropped &.
- Add box-sizing:border-box to the footer container so its 100% width includes
  the 2.2cm horizontal padding; Chromium's footer template is an isolated
  document that doesn't inherit the global border-box rule, so without it the
  padded footer overflowed the page box and could clip the page number.
Dragging a card to another project routed through card.update, whose SQL
COALESCE list has no project_id/workspace_id columns — so the move updated
column_id but left project_id/workspace_id on the old project. The row was
then inconsistent (column in project B, project_id in project A) and
re-surfaced in the source project on the next board refresh or sync reconcile,
exactly like the note-move bug that already has a dedicated query.

- Add q.moveCardToProject (direct SET of project_id + workspace_id + column_id
  + order; resolves the workspace from the target project and validates the
  target column belongs to it).
- Add db:card:moveToProject IPC handler (+ relationship/semantic recompute for
  the new workspace) and card.moveToProject preload binding.
- Route the store's moveCardToProject and its undo/redo command through the new
  channel; thread prevWorkspaceId so undo restores the original workspace too.
- Unit tests + changelog.
@ddutchie
ddutchie merged commit 1988900 into main Jul 25, 2026
6 checks passed
@ddutchie
ddutchie deleted the ddutchie/pdfnotefixes branch July 25, 2026 17:10
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