Conversation
|
Someone is attempting to deploy a commit to the Trustless Work Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughAdds client-side PDF export: introduces jsPDF dependency, an "Export to PDF" button in the escrow detail UI with loading/toast handling, and a new utility at Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant UI as Escrow Detail (Button)
participant Export as exportEscrowReport
participant jsPDF as jsPDF Library
participant Browser as Browser Download
User->>UI: Click "Export to PDF"
UI->>UI: set exporting=true (show loader)
UI->>Export: exportEscrowReport(organized, network)
Export->>Export: load logo (optional)
Export->>jsPDF: init doc, add header/meta/content
Export->>jsPDF: paginate & wrap text
Export->>jsPDF: finalize & save file
jsPDF->>Browser: trigger download
Browser->>User: Download PDF
UI->>UI: set exporting=false (hide loader)
Note right of Export: filename -> trustlesswork-escrow-{id}-{network}.pdf
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related issues
Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧬 Code graph analysis (2)src/utils/pdf/exportEscrowReport.ts (2)
src/components/escrow/escrow-content.tsx (1)
🔇 Additional comments (2)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (3)
package.json(1 hunks)src/components/escrow/escrow-content.tsx(3 hunks)src/utils/pdf/exportEscrowReport.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/components/escrow/escrow-content.tsx (1)
src/utils/pdf/exportEscrowReport.ts (1)
exportEscrowReport(36-206)
src/utils/pdf/exportEscrowReport.ts (2)
src/mappers/escrow-mapper.ts (1)
OrganizedEscrowData(28-37)src/lib/escrow-constants.ts (1)
ROLE_MAPPING(12-23)
🔇 Additional comments (6)
src/components/escrow/escrow-content.tsx (1)
11-13: LGTM!The imports are correctly organized and necessary for the PDF export feature.
src/utils/pdf/exportEscrowReport.ts (4)
43-50: LGTM!The
linehelper correctly handles pagination by detecting when content exceeds the page height and creating a new page with a re-rendered header. The logic is sound.
52-68: LGTM!The text wrapping and formatting logic correctly handles multi-line content with proper line advancement. The separation of concerns between text rendering and line advancement is intentional and provides flexibility.
76-94: LGTM!The header rendering with optional logo, title, network tag, and divider line is well-implemented. The graceful fallback when the logo is unavailable ensures the report can always be generated.
135-143: LGTM!The defensive programming throughout this code is excellent:
- Using
String(props.engagement_id || "-")for potentially missing properties- Type guards for optional milestone fields (
typeof m.signer === "string")- Fallback values for missing data
This ensures the PDF generation is robust even with incomplete data.
Also applies to: 159-163, 179-197
package.json (1)
23-23: No issues found—jspdf version is current and secure.Version 3.0.3 is the latest release and is not affected by any known security vulnerabilities. The caret constraint (^3.0.3) is appropriate and safe.
PR Title
Feature: PDF Export for Escrow Audit Report
Summary
Adds a client-side “Export to PDF” feature to the Escrow Viewer. Users can generate a downloadable PDF audit report for any escrow (Testnet/Mainnet) with header, footer, and key configuration details.
What’s Included:
UI/UX
How to Test
Create a Testnet escrow in the BackOffice (multi-release recommended).
Open the escrow in the Viewer.
Click “Export to PDF”.
Verify:
Header, footer, timestamp, network tag (Testnet/Mainnet).
Escrow ID, Engagement ID, Description, Platform Fee.
Roles (marker, approver, receiver, release signer, platform, dispute resolver).
Milestones (titles, amounts for multi-release, status/approved).
Layout and pagination look good for multiple milestones.
Screenshots:
Notes / Limitations:
Asset info currently shows the trustline address. The acceptance criteria mentions “Asset (code, issuer)”. The app does not yet expose code/issuer; a follow-up could resolve asset code/issuer from the trustline via a public API and include it in the PDF.
Future Enhancements
Technical:
New dependency: jspdf.
exportEscrowReport is async and runs fully client-side.
Uses existing ROLE_MAPPING for readable role labels.
Button added in EscrowContent near the title section.
Acceptance Criteria Mapping
“Export to PDF” button visible on escrow detail view: Implemented.
PDF includes roles, milestones, metadata, and fees: Implemented.
Works for single- and multi-release escrows: Implemented.
Header, footer, date, and network tag: Implemented.
Fully client-side: Implemented.
Documentation and screenshots: Included in this PR.
closes #28
Summary by CodeRabbit
New Features
Chores