Skip to content

fix(card): gate share-asset row on "went through the flow" (part 2/2 FE)#2146

Open
Hugo0 wants to merge 1 commit into
mainfrom
feat/card-celebration-seen-fe
Open

fix(card): gate share-asset row on "went through the flow" (part 2/2 FE)#2146
Hugo0 wants to merge 1 commit into
mainfrom
feat/card-celebration-seen-fe

Conversation

@Hugo0
Copy link
Copy Markdown
Contributor

@Hugo0 Hugo0 commented Jun 1, 2026

Follow-up to #2144. Pairs with peanut-api-ts #927 (the BE half).

What

Two things, both in HomeHistory / the card-unlock gate:

  1. Broadens the gate from fix(card): gate card-unlock history row on an issued card, not access #2144's issued-card-only to Hugo's actual intent — "went through the flow": saw the celebration (cardInfo.skipCelebrationSeen, persisted by fix: withdraw flow bugs #927) OR holds a card. deriveCardUnlockEntry's param is now wentThroughFlow. Stamps the write-once server marker (cardApi.markCelebrationSeen()) when the user dismisses the celebration.
  2. Re-applies the eslint cleanup that was lost when fix(card): gate card-unlock history row on an issued card, not access #2144 was merged before its 2nd commit (f1bd4be29) landed — typed the badge synthetic row (BadgeHistoryEntry in the entries union, b.id guard), dropping two pre-existing anys in HomeHistory.tsx. Without this, the next PR touching the file fails eslint.

Why

#2144's issued-card gate stopped the bleeding (3,230 bogus → 9) but is stricter than intended — it hides the row from users who went through the flow without a card. The truthful signal is the celebration-seen marker (#927 wires the long-deferred column).

Safe deploy order / back-compat

skipCelebrationSeen is optional in CardInfoResponseundefined until #927 ships, treated as "not seen". So:

  • Merge/deploy fix: withdraw flow bugs #927 (BE) first; then this FE broadens automatically.
  • If this merges first, it just behaves like today's issued-card gate (no regression) until the BE catches up.
  • markCelebrationSeen() failures are swallowed (console.error) — a 404 before the BE ships won't break the celebration dismiss.

Verify

  • cardUnlock.types.test.ts updated (5 cases incl. the gabby access-only → null regression). All pass.
  • eslint clean, changed files typecheck clean, prettier clean.
  • Back-merge to dev after merge.

…lint

Follow-up to #2144. Broadens the activity-feed card-unlock gate from
issued-card-only to "went through the flow" = saw the celebration
(cardInfo.skipCelebrationSeen, persisted by peanut-api-ts #927) OR holds a
card (a cardholder definitionally went through, and this keeps the 9
pre-wiring cardholders). Stamps the write-once server marker on
celebration dismiss.

skipCelebrationSeen is optional — undefined until the BE ships — so this
behaves exactly like the current issued-card gate until then, then
broadens automatically. Deploy BE (#927) first.

Also re-applies the eslint cleanup lost when #2144 was merged before its
2nd commit landed: typed the badge synthetic row (BadgeHistoryEntry in
the entries union, b.id guard, dropped two pre-existing `any`s).
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment Jun 1, 2026 2:32pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Warning

Review limit reached

@Hugo0, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 21 minutes and 54 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 70ebe12c-00b3-4103-83f6-7de50a59fa16

📥 Commits

Reviewing files that changed from the base of the PR and between 2e169c4 and 3c9b8e6.

📒 Files selected for processing (5)
  • src/app/(mobile-ui)/card/page.tsx
  • src/components/Card/__tests__/cardUnlock.types.test.ts
  • src/components/Card/cardUnlock.types.ts
  • src/components/Home/HomeHistory.tsx
  • src/services/card.ts

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

Code-analysis diff

Painscore total: 5842.82 → 5844.59 (+1.77)
Findings: +1 net (+20 new, -19 resolved)

🆕 New findings (20)

  • critical complexity — src/app/(mobile-ui)/card/page.tsx — CC 98, MI 57.1, SLOC 394
  • critical complexity — src/components/Home/HomeHistory.tsx — CC 95, MI 58.27, SLOC 300
  • high hotspot — src/components/Home/HomeHistory.tsx — 32 commits, +299/-208 lines since 6 months ago
  • high hotspot — src/app/(mobile-ui)/card/page.tsx — 30 commits, +939/-371 lines since 6 months ago
  • medium high-mdd — src/app/(mobile-ui)/card/page.tsx:52 — CardPage: MDD 93.1 (uses across many lines from declarations)
  • medium high-mdd — src/components/Home/HomeHistory.tsx:49 — HomeHistory: MDD 72.2 (uses across many lines from declarations)
  • medium high-dlt — src/app/(mobile-ui)/card/page.tsx:52 — CardPage: DLT 50 (calls 50 distinct functions — high context load)
  • medium high-mdd — src/components/Home/HomeHistory.tsx:152 — : MDD 31.8 (uses across many lines from declarations)
  • medium complexity — src/services/card.ts — CC 28, MI 62.47, SLOC 100
  • medium high-mdd — src/components/Home/HomeHistory.tsx:157 — processEntries: MDD 26.2 (uses across many lines from declarations)
  • medium high-mdd — src/components/Home/HomeHistory.tsx:440 — : MDD 22.9 (uses across many lines from declarations)
  • medium method-complexity — src/components/Home/HomeHistory.tsx:157 — CC 16 SLOC 74
  • low high-dlt — src/components/Home/HomeHistory.tsx:152 — : DLT 20 (calls 20 distinct functions — high context load)
  • low high-dlt — src/components/Home/HomeHistory.tsx:157 — processEntries: DLT 19 (calls 19 distinct functions — high context load)
  • low structural-dup — src/components/Home/HomeHistory.tsx:169 — 12 duplicate lines / 0 tokens with src/app/(mobile-ui)/history/page.tsx:161
  • low structural-dup — src/services/card.ts:102 — 9 duplicate lines / 0 tokens with src/services/card.ts:72
  • low structural-dup — src/services/card.ts:119 — 9 duplicate lines / 0 tokens with src/services/card.ts:72
  • low structural-dup — src/services/card.ts:87 — 8 duplicate lines / 0 tokens with src/services/card.ts:58
  • low any-usage — src/components/Home/HomeHistory.tsx — 1 any annotation(s)
  • low missing-return-type — src/components/Home/HomeHistory.tsx:506 — HistorySkeleton: exported fn missing return type annotation

✅ Resolved (19)

  • src/app/(mobile-ui)/card/page.tsx — CC 98, MI 57.24, SLOC 389
  • src/components/Home/HomeHistory.tsx — CC 93, MI 58.3, SLOC 300
  • src/components/Home/HomeHistory.tsx — 31 commits, +284/-202 lines since 6 months ago
  • src/app/(mobile-ui)/card/page.tsx:52 — CardPage: MDD 87.3 (uses across many lines from declarations)
  • src/components/Home/HomeHistory.tsx:49 — HomeHistory: MDD 71.4 (uses across many lines from declarations)
  • src/app/(mobile-ui)/card/page.tsx:52 — CardPage: DLT 49 (calls 49 distinct functions — high context load)
  • src/components/Home/HomeHistory.tsx:149 — : MDD 30.9 (uses across many lines from declarations)
  • src/app/(mobile-ui)/card/page.tsx — 29 commits, +927/-370 lines since 6 months ago
  • src/components/Home/HomeHistory.tsx:154 — processEntries: MDD 25.6 (uses across many lines from declarations)
  • src/components/Home/HomeHistory.tsx:431 — : MDD 22.9 (uses across many lines from declarations)
  • src/services/card.ts — CC 23, MI 63.06, SLOC 81
  • src/components/Home/HomeHistory.tsx:154 — CC 15 SLOC 74
  • src/components/Home/HomeHistory.tsx:149 — : DLT 20 (calls 20 distinct functions — high context load)
  • src/components/Home/HomeHistory.tsx:154 — processEntries: DLT 19 (calls 19 distinct functions — high context load)
  • src/components/Home/HomeHistory.tsx:162 — 11 duplicate lines / 0 tokens with src/app/(mobile-ui)/history/page.tsx:160
  • src/services/card.ts:97 — 9 duplicate lines / 0 tokens with src/services/card.ts:67
  • src/services/card.ts:82 — 8 duplicate lines / 0 tokens with src/services/card.ts:53
  • src/components/Home/HomeHistory.tsx — 2 any annotation(s)
  • src/components/Home/HomeHistory.tsx:497 — HistorySkeleton: exported fn missing return type annotation

📈 Painscore deltas (top movers)

File Before After Δ
src/services/card.ts 7.9 9.2 +1.3

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

🧪 UI test report — ✅ all green

Suites

  • unit: 1259 ran, 0 failed, 0 skipped, 19.2s

📊 Coverage (unit)

metric %
statements 50.2%
branches 31.0%
functions 34.3%
lines 50.0%
⏱ 10 slowest test cases
time test
0.3s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every stamp stays within canvas at any count
0.3s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in updateUserById body
0.3s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in updateUserById
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid German IBAN
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid 9-digit US account
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle too long for US account
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid ETH address with surrounding spaces
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle invalid ETH address (missing 0x prefix)
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle maximum length (17 digits) US account
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid US account with spaces 2
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

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