design: tx receipt share as image - #571
Open
lockoabosede8-byte wants to merge 1 commit into
Open
Conversation
|
@lockoabosede8-byte Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #481
Summary
Introduces an enhanced
TransactionReceiptSharecomponent that generates compact, branded receipt images for sharing via chat or social media. The component provides three aspect ratios, a privacy toggle, clipboard copy with fallback, and full WCAG 2.1 AA accessibility.Key Changes
Component (
TransactionReceiptShare.tsx)aria-pressedstate••••••in the generated image; includes a visible "Hidden for privacy" badge on the cardClipboardItemAPI with PNG blob; falls back gracefully to file download when clipboard is unavailable or blockedhtml2canvas; sanitized filename from transaction IDwindow.alert()with a styled toast (role="status",aria-live="polite", auto-dismiss at 4s, manual dismiss button); supports success/error/info variantsuser-select: none+data-sensitive="true"with shield icon indicators and descriptivearia-labelcanvas.toBlobpromisified to ensureisCapturingstate correctly gates buttons until clipboard/download completesuseEffectcleanup prevents state updates on unmounted componentStyles (
TransactionReceiptShare.css).tx-receipt-card--compact,--square(1:1),--wide(16:9)prefers-reduced-motionoverrideinset-inline-end,text-align: start/end)forced-colors: activesupport (Windows High Contrast)@media print) with A4/US Letter support, monochrome optimization.tx-sr-onlyutility classTests (
TransactionReceiptShare.test.tsx)Documentation (
docs/uiux/tx-receipt-share-as-image.md)Config (
vite.config.ts)TransactionReceiptShare.tsxto coverageincludearrayAccessibility (WCAG 2.1 AA)
toolbar,region,status,grouparia-live="polite"on toast and hidden SR-only regionaria-pressedon toggles,aria-busyduring capturearia-label<button>elements with visible:focus-visibleringsResponsive Design
Edge Cases Covered
word-break: break-allwithmax-width: 60%html2canvasreturns nullisCapturingresetcanvas.toBlobreturns nullisCapturingresethtml2canvasthrowsuseEffectcleanup clears timerBefore / After
Before
window.alert()for feedbackAfter
Testing