Skip to content

feat: invoice preview panel, send modal, and activity timeline#127

Merged
0xdevcollins merged 1 commit intomainfrom
feat/invoice-preview-send-flow-issue-70
Apr 4, 2026
Merged

feat: invoice preview panel, send modal, and activity timeline#127
0xdevcollins merged 1 commit intomainfrom
feat/invoice-preview-send-flow-issue-70

Conversation

@0xdevcollins
Copy link
Copy Markdown
Owner

Closes #70

Summary

SendInvoiceModal

  • Pre-filled recipient email (editable) with inline validation
  • Custom message textarea (up to 1000 chars) with character counter
  • Invoice summary card showing invoice #, customer, total, and due date
  • Async onConfirm(invoice, message?) — integrates with existing useSendInvoice hook
  • Opens from the "Send Invoice" button in InvoiceDetailSheet; replaces the previous direct-fire behaviour

InvoicePdfPreview

  • Full-screen dialog (sm:max-w-4xl, h-[90vh]) wrapping the Cloudinary PDF URL in an <iframe>
  • Header action bar: Open, Print, and Download buttons
  • useInvoicePdf query hook auto-fetches the URL on open; 5-min stale time avoids redundant regeneration
  • Loading spinner while PDF is being generated; error state with fallback download button
  • Mobile fallback (< sm) shows "Open in browser" + "Download" since PDF iframes don't work on small viewports
  • Triggered via Preview button in the InvoiceDetailSheet header

InvoiceDetailSheet (enhanced)

  • Preview button in the sheet header opens InvoicePdfPreview
  • Activity timeline — derived from invoice status:
    • Created → Sent → Viewed → Paid (or Overdue / Cancelled branch)
    • Completed steps rendered in primary colour; pending steps shown greyed-out with a "Pending" badge
    • Timestamps shown where available (createdAt, paidAt, dueDate)
  • Payment details section — appears for PAID / PARTIALLY_PAID status:
    • Amount received, payment date, balance due (if partial)
  • Send Invoice button now opens SendInvoiceModal (no more confirm → immediate send)

Acceptance criteria

  • PDF preview shows rendered invoice with merchant branding
  • Download PDF and Print buttons work
  • Send flow delivers email with optional custom message and updates status
  • Activity timeline shows all state changes
  • Toast notifications on success/error
  • Works on mobile (375px) — PDF preview degrades gracefully

Test plan

  • Open a DRAFT invoice → click "Preview" → verify PDF renders in dialog
  • Click "Print" — browser print dialog should appear
  • Click "Send Invoice" → modal opens with customer email pre-filled
  • Add a custom message → Send → verify email received with message
  • Status badge in the list updates to SENT after send
  • Open a PAID invoice → verify payment details section is visible
  • Open a CANCELLED invoice → verify timeline shows Cancelled branch
  • Test on 375px viewport — preview shows mobile fallback correctly

🤖 Generated with Claude Code

…70)

- Add SendInvoiceModal — dialog with pre-filled recipient email, custom
  message textarea (1000 char), invoice summary card, and Send button;
  validates email before dispatching
- Add InvoicePdfPreview — full-screen dialog (sm:max-w-4xl) with iframe
  embedding the Cloudinary PDF URL; Download, Print, and Open-in-tab
  buttons in the header; mobile fallback shows action buttons without iframe
- Rewrite InvoiceDetailSheet — adds activity timeline (created → sent →
  viewed → paid/overdue/cancelled) with animated step indicator and derived
  timestamps; adds payment details section for PAID/PARTIALLY_PAID;
  adds "Preview" button in the sheet header; "Send Invoice" button now
  opens SendInvoiceModal instead of firing immediately
- Add useInvoicePdf query hook — auto-fetches PDF URL when preview is open;
  5-minute stale time so it's only regenerated when necessary
- Update onSend signature to (invoice, message?) across table and page;
  handleSendExisting forwards optional message to sendInvoice mutation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@0xdevcollins 0xdevcollins merged commit 72983aa into main Apr 4, 2026
2 of 5 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.

Dashboard: Invoice PDF Preview & Send Flow

1 participant