Repository navigation
feat(flashcard): show the Cashu card on the home screen - #750
Merged
Merged
Conversation
The home screen's Flashcard row only ever showed a BoltCard: it is gated on the BoltCard's lnurl, so a Cashu card never appeared there. The card this phone read last now gets its own Flashcard row, with the balance it held at that read, and the row is hidden when the phone remembers no card. - `useKnownCashuCard`: the most recently read card from the flashcardV2 slice (signed-in reads only; Remove card drops it, logout clears them). - The row shows the balance in the display currency, and the card's own figure (no currency code) before the price is in or when the mint has not named the unit. Pressing it opens the card read this session, or asks for a tap. - `Balance` takes an optional testID. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…akes its place The home row showed the card this phone read most recently. Remove card dropped that card, and the row then showed the next one on record: on the test Pixel, the card's own pre-reinstall record (0.2, 149 sats), so the card looked still attached. The flashcardV2 slice now records the attached card: every signed-in read attaches the card it read, Remove card detaches it, logout clears it. The home row shows the attached card only, and other cards the phone has read stay on record without showing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…'s taps Review fixes for the Home Cashu card row. - flashcard-tap-call-sites.spec.tsx renders the row with an attached card and no card read this session, and pins both of its controls: the body and the sync each route one tap through useTapFlashcard with no options, so a BoltCard tapped there opens Card. The Balance mock keys its test ids on the tile's testID where it has one, since both Home rows are titled Flashcard. - wallet-overview-cashu-card.spec.tsx covers the empty card: no unit named, balance 0, shown as a Bitcoin zero in the display currency, never as "unit unknown". - useKnownCashuCard is now useAttachedCashuCard (use-attached-cashu-card.ts), and the comments and test labels that still described the first commit's "remembered card" rule now say "attached". - migrations.ts: a new flashcardV2 field that starts with a value needs its own version and migration; an optional field that starts absent, as attachedPubkey does, needs neither. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…session Review fix for the Home Cashu card row. The sync test ran only with no card read this session, where the sync (tapFlashcard) and the body (openCashuCard) make the same tap, so a sync wired to openCashuCard passed every suite. With a card read this session that sync would open the session's read, a balance a spend at a till has since made stale, and ask for no tap. - flashcard-tap-call-sites.spec.tsx: the useFlashcard mock returns cashuCard from mockSessionCard, reset in beforeEach. New test: with a card attached and read this session, the row's sync still routes one tap. - A companion test pins the body in that state: it opens FlashcardV2 without a tap. It also proves the session's read reaches the row, so the sync test cannot pass for want of one. - useNavigation's navigate is a shared mockNavigate, and expectTapped and expectOpened assert the call site navigates nowhere itself, so a control that navigates and taps fails too. Mutation checks: the sync wired to openCashuCard fails the new sync test; a sync that navigates and taps fails both sync tests; a body that always taps fails the new body test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Home row is the first reader of the slice's unit together with lastBalance. cardSeen kept the unit the mint named for an earlier read even when the balance had moved, so a card spent to zero and reloaded in USD on another phone would show on Home in sats whenever this phone's tap lost the keyset split (latent while cashuCardUsdEnabled is off). A read now keeps the unit only while its balance still stands, as recordCardOperation already does; the unit returns when cardUnitResolved names it again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
The home screen's Flashcard row only ever showed a BoltCard: it renders only when a BoltCard
lnurlis linked, so a Cashu card never appeared there. Now the Cashu card attached to the app gets its own Flashcard row. That's the card read last, until Remove card detaches it. The row is hidden when no card is attached.flashcardV2.attachedPubkey: every signed-in read attaches the card it read, Remove card detaches it, and logout clears it.useKnownCashuCardreturns the attached card. Other cards the phone has read stay on record without showing.The row shows the balance the card held at that last read:
1289 sats) with no currency code after it;Pressing it opens the card read this session, or asks for a tap; the sync button taps. A linked BoltCard keeps its own row, unchanged.
Balancetakes an optionaltestID.Choices worth a look:
Tests: a new spec covers:
attachedCard, and the slice attaching on a read and detaching on Remove.Each fails when the behaviour it names is removed. Three existing specs that mock
@app/hooksadd the new hook. Full suite: 155 suites, 1,830 tests.Requested during the 2026-10-02 device test.
🤖 Generated with Claude Code