Skip to content

feat(pay): manual-transfer copy-fields + confirmation button#72

Merged
codebestia merged 4 commits into
ShadeProtocol:mainfrom
pre-cious-Igwealor:feat/copy-address-amount-confirm-payment
May 30, 2026
Merged

feat(pay): manual-transfer copy-fields + confirmation button#72
codebestia merged 4 commits into
ShadeProtocol:mainfrom
pre-cious-Igwealor:feat/copy-address-amount-confirm-payment

Conversation

@pre-cious-Igwealor
Copy link
Copy Markdown
Contributor

Summary

Builds out the manual-transfer payment flow: two read-only fields with copy-to-clipboard icons for the destination address and amount, plus a primary "I have sent the payment" button that drops into a verifying state while the parent waits for on-chain confirmation. The pay-tabs "Manual transfer" panel now renders this view in place of the previous placeholder copy.

closes #55
closes #56

Changes

  • Create "Copy Address & Amount" Component #55 — Copy Address & Amount component:

    • src/components/pay/copy-address-amount.tsx (new): two read-only inputs (address + amount) each paired with a Copy icon button. After a successful copy, the icon swaps to a Check with "Copied" for ~1.5s and fires a notify.success(...) toast via the existing lib/toast wrapper. Clipboard write prefers navigator.clipboard.writeText and falls back to an offscreen textarea + execCommand("copy") so the component still works in non-secure (HTTP) contexts, embedded webviews, and older browsers. A11y: associated <label>, aria-label on the icon button, aria-pressed to convey the copied state, and click-to-select-all on focus.
  • Create "Confirm Payment Sent" Button #56 — Confirm Payment Sent button:

    • src/components/pay/confirm-payment-button.tsx (new): primary <Button size="lg"> with an idle → verifying → verified state machine. On click it sets verifying, invokes the parent-provided onConfirm callback (where the real chain polling lands), and on resolution switches to verified. Marked aria-busy during verification and aria-live="polite" so screen readers announce the transition.
    • src/components/pay/manual-transfer-view.tsx (new): pulls CopyAddressAmount (Create "Copy Address & Amount" Component #55) and ConfirmPaymentButton (Create "Confirm Payment Sent" Button #56) together into a single panel, with placeholder demo address/amount so the flow renders cleanly today; the real invoice-bound values + Horizon polling land in a follow-up wire-up task.
    • src/components/pay/pay-tabs.tsx: renders <ManualTransferView /> inside the "Manual transfer" tabpanel in place of the previous "Manual transfer instructions will appear here." placeholder.

Test plan

  • npx tsc --noEmit — passes cleanly.
  • npm run lint — passes for the new files. Pre-existing errors elsewhere (src/app/sign-in/sign-in-client.tsx unused import; src/components/avatar/avatar-upload.tsx <img> warning) are untouched by this PR and visible on main too.
  • Manual verification: switch to the "Manual transfer" tab → fields render with placeholder values; clicking either copy button writes to the clipboard, swaps to a check + "Copied", and fires the success toast; clicking "I have sent the payment" disables the button and shows the verifying spinner before settling on "Payment confirmed".

Risk notes

  • Address/amount are placeholders for now; the real invoice → manual-transfer wiring is intentionally out of scope and will be threaded through ManualTransferView's existing props in a follow-up.
  • Clipboard fallback intentionally avoids any layout shift (fixed positioning + opacity 0) so the copy action is non-disruptive on mobile.

Note: this contribution was authored with AI assistance (Claude Code).

pre-cious-Igwealor and others added 4 commits May 30, 2026 11:32
…Protocol#55)

Adds CopyAddressAmount — two read-only fields (address and amount)
each wired to a copy-to-clipboard icon button — to support the
manual-transfer payment flow.

- src/components/pay/copy-address-amount.tsx: prefers the async
  Clipboard API and falls back to an offscreen textarea +
  execCommand("copy") so it still works in non-secure (HTTP)
  contexts, embedded webviews, and older browsers.
- Surfaces success / failure via the existing notify() helper and
  swaps the icon to a check + "Copied" label for ~1.5s after a
  successful copy.
- A11y: associated <label>, aria-pressed on the toggle, aria-label
  on the icon button, and click-to-select-all on focus.

Co-Authored-By: Claude <noreply@anthropic.com>
…ol#56)

Adds the primary action at the bottom of the manual-transfer view.
On click it enters a "Verifying on-chain…" loading state, fires the
parent-provided onConfirm callback (which is where the real chain
polling lands in a follow-up), and renders a clear "Payment
confirmed" success state once verification resolves.

- src/components/pay/confirm-payment-button.tsx: state machine
  idle → verifying → verified with aria-busy and aria-live="polite"
  so screen readers announce the verification step.
- src/components/pay/manual-transfer-view.tsx (new): pulls together
  CopyAddressAmount (ShadeProtocol#55) and ConfirmPaymentButton (ShadeProtocol#56) into a
  single panel with placeholder demo address/amount; the real
  invoice-bound values land in a follow-up wire-up task.
- src/components/pay/pay-tabs.tsx: renders ManualTransferView in
  the "Manual transfer" tab in place of the previous placeholder
  copy.

Co-Authored-By: Claude <noreply@anthropic.com>
- Regenerated package-lock.json so `npm ci` resolves cross-platform
  optional deps (the previous lockfile was missing typescript@4.9.5 and
  utf-8-validate@5.0.10 entries that `@twind/*` transitively pulls in).
- Ran Prettier on the four files this PR added/changed under
  `src/components/pay/`. Other format:check warnings in the repo are
  pre-existing on main and out of this PR's scope.

Done with AI assistance, as previously disclosed on this PR.
Copy link
Copy Markdown
Contributor

@codebestia codebestia left a comment

Choose a reason for hiding this comment

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

LGTM!
Thanks.

@codebestia codebestia merged commit 1aca0e3 into ShadeProtocol:main May 30, 2026
1 check failed
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.

Create "Confirm Payment Sent" Button Create "Copy Address & Amount" Component

2 participants