Skip to content

feat: add receipt dialog with drag-to-tear download - #56

Merged
ridemountainpig merged 6 commits into
mainfrom
feat/receipt-dialog
May 24, 2026
Merged

feat: add receipt dialog with drag-to-tear download#56
ridemountainpig merged 6 commits into
mainfrom
feat/receipt-dialog

Conversation

@ridemountainpig

Copy link
Copy Markdown
Owner

Summary

  • New ReceiptDialog on the subscription page that prints a receipt-style summary of the month's actual charges (non-amortized), with a printing animation, barcode decoration, and totals
  • Drag-to-tear interaction: pull the printed receipt upward past the threshold to download it as a PNG (via html-to-image); the captured image keeps the torn zigzag edge
  • Adds receipt.* strings to all four locales (en, es, ja, zh)

Test plan

  • Open the subscription page, click the receipt icon, and confirm the print animation runs and the item count matches the visible subscriptions for the selected month
  • Switch to a previous month and verify the receipt reflects that month's charges
  • On desktop, drag the printed receipt upward — confirm rubber-band resistance, the button label flips to "Release to download" past threshold, and releasing downloads a PNG named subflow-receipt-YYYY-MM.png
  • On touch, swipe up from the bottom of the receipt and confirm the same tear-off + download flow
  • Click the Download button directly and confirm it produces the same PNG
  • Switch locales (en/es/ja/zh) and confirm all receipt strings render correctly

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new “Receipt” UX to the subscription page that renders a receipt-style view of the selected month’s non-amortized charges, animates a print-out effect, and enables downloading the torn-off receipt as a PNG (via html-to-image). This fits into the existing subscription dashboard tooling alongside the chart dialog and other subscription management controls.

Changes:

  • Add new client component ReceiptDialog with print animation, drag-to-tear gesture, and PNG download.
  • Add html-to-image dependency for DOM-to-PNG export.
  • Add receipt.* i18n strings for en/es/ja/zh locales.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
package.json Adds html-to-image dependency required for receipt PNG export.
pnpm-lock.yaml Locks html-to-image@1.11.13 and updates snapshots accordingly.
messages/en.json Adds English strings for the receipt dialog UI.
messages/es.json Adds Spanish strings for the receipt dialog UI.
messages/ja.json Adds Japanese strings for the receipt dialog UI.
messages/zh.json Adds Chinese strings for the receipt dialog UI.
components/subscription/receipt-dialog.tsx New receipt dialog implementation: rendering, animation, gesture handling, and download flow.
app/[locale]/subscription/page.tsx Wires ReceiptDialog into the subscription page header actions and adjusts spacing/icon sizing classes.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/[locale]/subscription/page.tsx
Comment thread app/[locale]/subscription/page.tsx
Comment thread app/[locale]/subscription/page.tsx
Comment thread components/subscription/receipt-dialog.tsx Outdated
Comment thread components/subscription/receipt-dialog.tsx Outdated
Comment thread components/subscription/receipt-dialog.tsx
- Switch toPng to toBlob + object URL to avoid large base64 strings
- Stabilize drag-to-tear handler via ref so latest downloadReceipt is called
- Add aria-label to the icon-only receipt trigger

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread app/[locale]/subscription/page.tsx
Comment thread app/[locale]/subscription/page.tsx
Comment thread components/subscription/receipt-dialog.tsx Outdated
Comment thread components/subscription/receipt-dialog.tsx Outdated
- Move amount formatter into the component so it follows the active locale's
  grouping and decimal separators, matching the rest of the receipt
- Always render the actual generation date/time (refreshed on each open)
  instead of synthesizing the first-of-month for past periods; the billing
  period is still shown separately as #YYYY-MM

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread components/subscription/receipt-dialog.tsx
Comment thread components/subscription/receipt-dialog.tsx Outdated
…ubtotal

- Mouse path now mirrors touch: when the cursor moves below the start point
  we reset the baseline so a subsequent upward motion starts tearing again
  from the current cursor instead of from the original mousedown
- Subtotal line now includes the currency code so the downloaded PNG is
  unambiguous as a standalone document

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread components/subscription/receipt-dialog.tsx Outdated
Comment thread components/subscription/receipt-dialog.tsx Outdated
- Defer URL.revokeObjectURL by 1s so Safari/WebKit can start the download
  before the blob URL is invalidated
- Render each line in the display currency (using convertedAmount) so item
  amounts add up to the subtotal/total; the original amount + currency is
  shown as a small secondary note next to the name when it differs

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread components/subscription/receipt-dialog.tsx
The motion value change event fires every frame while dragging; route the
setState through a ref check so React only sees a state change when the
threshold is actually crossed instead of on every pointer-move tick.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@ridemountainpig
ridemountainpig merged commit 4852898 into main May 24, 2026
1 check passed
@ridemountainpig
ridemountainpig deleted the feat/receipt-dialog branch May 24, 2026 06:49
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