Skip to content

fix(flashcard): open the top-up on its keypad - #749

Merged
islandbitcoin merged 3 commits into
mainfrom
jabariennis/flashcard-v2-topup-keypad
Oct 4, 2026
Merged

islandbitcoin merged 3 commits into
mainfrom
jabariennis/flashcard-v2-topup-keypad

Conversation

@islandbitcoin

@islandbitcoin islandbitcoin commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Tapping Top up on a Cashu card showed the amount field, and the keypad only came up once the field was tapped. A top-up's first job is its amount, so the keypad now opens by itself on the amount step.

  • AmountInput: a new opt-in initiallyOpen prop opens the keypad modal as the field mounts. It is read once, at mount, and later changes are ignored. It defaults to off, so every other screen keeps today's tap-to-open field. Prettier also reflowed one existing line in this file, which wasn't formatted on main either.
  • Top-up screen: the keypad opens once the card's unfinished top-ups have been read from the Keychain, because one of them can refuse this top-up or fix its unit. A top-up refused that way never shows the keypad. On an empty card that offers a choice of unit (the USD option), the keypad stays shut: the unit comes first, and the field opens the keypad as before. Once an amount is entered the keypad stays shut, including after a failed quote returns to the amount step.
  • The keypad, on every screen: Android's back key and back gesture now close it. Its modal had no onRequestClose, so back did nothing. Its close button now has a button role and a label for screen readers.
  • Keypad balance: for a sat top-up the keypad's header showed the self-custodial wallet's balance, $0.00 outside advanced mode, though the top-up is paid from the Cash wallet. A new optional balanceWalletCurrency prop sets whose balance the header shows, and the top-up passes the Cash wallet's. Other screens keep their header as it was.
  • Tests: the AmountInput spec covers opening at mount, closing a keypad that opened itself, and ignoring the prop after mount. A modal spec covers Android's back. A keypad spec renders the field, modal and amount screen for real: the header's wallet, the labelled close, and back. The top-up screen tests cover opening after the read (also when the read fails), never opening for a refused top-up, opening once an unfinished top-up fixes the unit, staying shut on a card that offers a unit choice, staying shut after an amount (also after a failed quote), and the Cash wallet header. Each fails when the behaviour it names is removed. Full suite: 157 suites, 1,839 tests.

Requested during the 2026-10-02 device test.

🤖 Generated with Claude Code

Dread and others added 3 commits October 2, 2026 14:51
Tapping Top up showed the amount field, and the keypad came up only once
the field was tapped. A top-up's first job is its amount, so the keypad now
opens as the amount step shows. It waits while an empty card's unit is still
to be chosen (the USD option), and stays shut once an amount is entered.

AmountInput takes an opt-in `initiallyOpen` prop for this; every other
screen keeps today's tap-to-open field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes for the top-up keypad.

- The keypad opened from the first render, before the Keychain read of
  the card's unfinished top-ups settled. A top-up that read then refused
  had its keypad presented and taken down at once, and an unfinished
  top-up that fixed an empty card's unit left the keypad shut. The field
  now mounts again once the read settles (whatever it found, or if it
  failed), and only that mount opens the keypad.
- Android's back key and back gesture reach a core Modal only as
  onRequestClose, which the keypad's modal did not set, so back did
  nothing while the keypad was up: now the top-up's landing state. Back
  now closes the keypad, on every screen that uses it.
- The keypad's header showed the balance of the wallet named by the
  amount's unit. For a sat top-up that is the self-custodial wallet,
  $0.00 outside advanced mode, while the top-up is paid from the Cash
  wallet. A balanceWalletCurrency prop names the paying wallet; the
  top-up passes the Cash wallet's, and every other screen is unchanged.
- The keypad's close button has a button role and a label for screen
  readers.
- choosingUnit is now offersUnitChoice, and its test is named for what
  the code does: picking a unit does not open the keypad.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review fixes for the top-up keypad, round 2.

- The amount field rendered before the Keychain read of the card's
  unfinished top-ups settled, and mounted again under a new key once it
  had. The pre-read field was live, so a keypad opened from it in that
  window was unmounted with its modal up when the read settled. What was
  typed was lost, and a second keypad was presented, or none on a card
  that offers a unit choice. The read waits its turn behind any other
  store work, such as the card screen's focus-time read.
- The field now renders only once the read has settled, with no key. It
  mounts once, so nothing is left to open before the read or to take
  down after it, and it opens the keypad unless an amount is entered or
  the card offers a choice of unit.
- AmountInput's initiallyOpen doc now says a screen that decides later
  mounts the field once it has decided, not that it remounts it.
- Specs: no field to tap while the read is held, then one mount, open.
  The keypad-opening specs expect one mount each. Entering an amount does
  not mount the field again, and a top-up the read refuses never mounts
  it. The flow specs let the read settle before pressing the field.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@islandbitcoin
islandbitcoin merged commit 28c6b42 into main Oct 4, 2026
8 of 9 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.

1 participant