Skip to content

[TASK-15655] Feat: Summary separator rendering#1356

Merged
Zishan-7 merged 3 commits intopeanut-wallet-devfrom
feat/summary-separator-rendering
Oct 27, 2025
Merged

[TASK-15655] Feat: Summary separator rendering#1356
Zishan-7 merged 3 commits intopeanut-wallet-devfrom
feat/summary-separator-rendering

Conversation

@Zishan-7
Copy link
Contributor

image

@vercel
Copy link

vercel bot commented Oct 23, 2025

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

Project Deployment Preview Comments Updated (UTC)
peanut-wallet Ready Ready Preview Comment Oct 27, 2025 6:31am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 23, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Adds group-aware row rendering to TransactionDetailsReceipt: introduces row groups, computes last visible item per group, centralizes bottom-border visibility via shouldHideGroupBorder, applies group-aware border logic across many rows, and reorders transaction detail row keys in the utils file.

Changes

Cohort / File(s) Change Summary
Receipt grouping & border logic
src/components/TransactionDetails/TransactionDetailsReceipt.tsx
Introduces row grouping (e.g., dateRows, txnDetails, fees), adds getLastVisibleInGroup() and shouldHideGroupBorder() helpers, tracks lastVisibleInGroups, and replaces ad-hoc border-hiding with group-aware logic across many PaymentInfoRow renderings (Created, Cancelled, Claimed, Completed, To, Token & Network, TX ID, bank/transfer rows, fees, deposit sections, and related conditional visibility).
Row key ordering
src/components/TransactionDetails/transaction-details.utils.ts
Reorders transactionDetailsRowKeys: moves to, tokenAndNetwork, and txId after completed; inserts mantecaDepositInfo after fee; moves peanutFee to follow networkFee; adjusts sequence of points/comment/attachment accordingly.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Pay attention to correctness of last-visible calculations and group boundary detection.
  • Verify visibility/border outcomes for rows whose rendering conditions were consolidated (Cancelled, Claimed, Completed, Peanut fee, deposit messaging).
  • Confirm the reordered transactionDetailsRowKeys does not break consumers that rely on prior ordering.

Possibly related PRs

Suggested reviewers

  • kushagrasarathe
  • jjramirezn

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description Check ❓ Inconclusive The pull request description contains only an embedded image reference with no accompanying explanatory text. While images can be helpful for demonstrating visual changes, they do not constitute a meaningful textual description of what the pull request accomplishes or why the changes are necessary. Without any text explanation of the changes, the purpose, or what the image represents, it is impossible to determine whether the image is actually related to the changeset or if it meaningfully documents the work being done. A description should communicate the intent and scope of changes to someone reviewing the PR. Add a textual description explaining the changes, why they were made, and what problem they solve. If the image is meant to demonstrate the visual result of the changes, include a brief caption or explanation describing what the image shows and how it relates to the implementation. This will make the PR's intent clear to reviewers and future maintainers.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[TASK-15655] Feat: Summary separator rendering" refers to a real aspect of the changeset, specifically the border/separator rendering logic. The actual changes center on implementing a grouping mechanism for rows that makes border rendering group-aware and centralizes the logic for when separators should be displayed. While "separator rendering" accurately reflects the implementation concern (borders/separators), the title doesn't capture the main architectural change—the introduction of grouping logic and the refactoring to make borders group-aware—which the summary describes as high review effort. The title is partially related to the changeset, referring to a genuine aspect of the changes but not fully conveying the primary objective.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbbc1da and 38c752a.

📒 Files selected for processing (1)
  • src/components/TransactionDetails/transaction-details.utils.ts (1 hunks)

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

@notion-workspace
Copy link

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)

478-481: Prevent double separators in txnDetails by hiding “Token amount” border

“Token amount” isn’t part of txnDetails group, so it still renders its own separator. When followed by tokenAndNetwork/txId, this creates two separators within the section. Hide the border on “Token amount” to let the group control the single separator.

-                                {!isStableCoin(transaction.tokenSymbol ?? 'USDC') && (
-                                    <PaymentInfoRow label="Token amount" value={transaction.amount} />
-                                )}
+                                {!isStableCoin(transaction.tokenSymbol ?? 'USDC') && (
+                                    <PaymentInfoRow label="Token amount" value={transaction.amount} hideBottomBorder />
+                                )}

Also applies to: 524-525, 551-552


116-183: rowVisibilityConfig deps: add isPublic (used by mantecaDepositInfo)

isPublic influences visibility but isn’t in the deps array. Add it so rows re-evaluate if the receipt toggles between public/private.

-    }, [transaction, isPendingBankRequest])
+    }, [transaction, isPendingBankRequest, isPublic])
🧹 Nitpick comments (2)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)

201-206: Group-aware border logic is correct; tighten typing and deps

Logic matches the intended behavior. Minor hardening:

  • Mark rowGroups as const to lock keys at the type level.
  • Include rowGroups in lastVisibleInGroups deps (future-proof).
-    const rowGroups = useMemo(
-        () => ({
-            dateRows: ['createdAt', 'cancelled', 'claimed', 'completed'] as TransactionDetailsRowKey[],
-            txnDetails: ['tokenAndNetwork', 'txId'] as TransactionDetailsRowKey[],
-            fees: ['networkFee', 'peanutFee'] as TransactionDetailsRowKey[],
-        }),
-        []
-    )
+    const rowGroups = useMemo(
+        () =>
+            ({
+                dateRows: ['createdAt', 'cancelled', 'claimed', 'completed'],
+                txnDetails: ['tokenAndNetwork', 'txId'],
+                fees: ['networkFee', 'peanutFee'],
+            } as const),
+        []
+    )
@@
-    const lastVisibleInGroups = useMemo(
+    const lastVisibleInGroups = useMemo(
         () => ({
             dateRows: getLastVisibleInGroup(rowGroups.dateRows),
             txnDetails: getLastVisibleInGroup(rowGroups.txnDetails),
             fees: getLastVisibleInGroup(rowGroups.fees),
         }),
-        [rowVisibilityConfig]
+        [rowVisibilityConfig, rowGroups]
     )

Also applies to: 207-216, 217-225, 227-239

src/components/TransactionDetails/transaction-details.utils.ts (1)

28-33: Order verified; apply compile-time guard to prevent drift

Ordering is correct and matches component render order. All keys are present in the union type with no duplicates or gaps. Contiguity checks pass:

  • Date rows (createdAt, cancelled, claimed, completed) at indices 0–3
  • Transaction details (tokenAndNetwork, txId) at indices 5–6
  • Fees (networkFee, peanutFee) at indices 15–16

Apply the compile-time guard to prevent keys from drifting:

-export const transactionDetailsRowKeys: TransactionDetailsRowKey[] = [
+export const transactionDetailsRowKeys = [
     'createdAt',
     'cancelled',
     'claimed',
     'completed',
     'to',
     'tokenAndNetwork',
     'txId',
     'fee',
     'mantecaDepositInfo',
     'exchangeRate',
     'bankAccountDetails',
     'transferId',
     'depositInstructions',
     'points',
     'comment',
     'networkFee',
     'peanutFee',
     'attachment',
-]
+] as const satisfies ReadonlyArray<TransactionDetailsRowKey>
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63b5aa8 and 7215e0d.

📒 Files selected for processing (2)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (9 hunks)
  • src/components/TransactionDetails/transaction-details.utils.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)
src/components/TransactionDetails/transaction-details.utils.ts (1)
  • TransactionDetailsRowKey (2-20)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (18-87)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (4)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (4)

424-454: Date rows: migration to group-based borders looks good

Created/Cancelled/Claimed/Completed correctly use shouldHideGroupBorder with dateRows.

Also applies to: 432-439, 440-447, 448-453


590-598: Exchange rate block: consistent separator handling

Always-hiding the first row’s border to pair with the second row’s conditional border is consistent. LGTM.


703-704: Deposit instructions: explicit borders are consistent

Explicit true/false flags look intentional for the collapsible block. LGTM.

Also applies to: 744-745, 853-854, 877-878


908-915: Fees group borders: correct usage; keep keys adjacent in order array

Using shouldHideGroupBorder for networkFee/peanutFee is correct. Ensure these keys remain adjacent in transactionDetailsRowKeys to avoid unexpected separators.

Validated by the array-order check suggested in transaction-details.utils.ts.

Also applies to: 917-922

Copy link
Contributor

@Hugo0 Hugo0 left a comment

Choose a reason for hiding this comment

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

lgtm but mmight have merge conflicts with perk-rework branch. please DO NOT merge b4 prod release

const isLastInGroup = rowKey === lastVisibleInGroups[groupName]
const isGlobalLast = shouldHideBorder(rowKey)

// if it's the last in its group, show border UNLESS it's also the global last
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)

134-202: Missing dependency in rowVisibilityConfig useMemo.

isPublic influences mantecaDepositInfo but is not in the deps array; the memo can go stale if isPublic changes.

-}, [transaction, isPendingBankRequest])
+}, [transaction, isPendingBankRequest, isPublic])
🧹 Nitpick comments (3)
src/components/TransactionDetails/transaction-details.utils.ts (1)

33-33: Consider a future “deposit” group for clarity.

mantecaDepositInfo and depositInstructions conceptually belong together. A dedicated group would make border rules simpler if more deposit fields are added.

src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)

236-244: Memo deps: tie to visibleRows.

If last-in-group uses visibleRows, memoize against visibleRows (not just rowVisibilityConfig) to avoid stale borders.

-const lastVisibleInGroups = useMemo(
-    () => ({
-        dateRows: getLastVisibleInGroup(rowGroups.dateRows),
-        txnDetails: getLastVisibleInGroup(rowGroups.txnDetails),
-        fees: getLastVisibleInGroup(rowGroups.fees),
-    }),
-    [rowVisibilityConfig]
-)
+const lastVisibleInGroups = useMemo(
+    () => ({
+        dateRows: getLastVisibleInGroup(rowGroups.dateRows),
+        txnDetails: getLastVisibleInGroup(rowGroups.txnDetails),
+        fees: getLastVisibleInGroup(rowGroups.fees),
+    }),
+    [visibleRows, rowGroups]
+)

591-616: Group-aware border usage: good; add one tweak for “Token amount”.

The switch to shouldHideGroupBorder for dateRows/txnDetails/fees looks right. To avoid a stray dashed separator between “Token amount” and “Token and network”, hide the border under “Token amount” when the latter is visible.

- {!isStableCoin(transaction.tokenSymbol ?? 'USDC') && (
-     <PaymentInfoRow label="Token amount" value={transaction.amount} />
- )}
+ {!isStableCoin(transaction.tokenSymbol ?? 'USDC') && (
+     <PaymentInfoRow
+         label="Token amount"
+         value={transaction.amount}
+         hideBottomBorder={rowVisibilityConfig.tokenAndNetwork}
+     />
+ )}

Also applies to: 699-701, 726-727, 1084-1090, 1092-1097

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7215e0d and cbbc1da.

📒 Files selected for processing (2)
  • src/components/TransactionDetails/TransactionDetailsReceipt.tsx (9 hunks)
  • src/components/TransactionDetails/transaction-details.utils.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/TransactionDetails/TransactionDetailsReceipt.tsx (2)
src/components/TransactionDetails/transaction-details.utils.ts (1)
  • TransactionDetailsRowKey (2-21)
src/components/Payment/PaymentInfoRow.tsx (1)
  • PaymentInfoRow (18-87)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Deploy-Preview
🔇 Additional comments (2)
src/components/TransactionDetails/transaction-details.utils.ts (1)

29-31: Reorder looks aligned; double-check grouping side effects.

Placing 'to', 'tokenAndNetwork', and 'txId' after 'completed' aligns with the component. 'mantecaDepositInfo' placement after 'fee' and 'peanutFee' after 'networkFee' keeps the fees contiguous.

To ensure grouping/border behavior stays correct, please confirm:

  • The date rows remain contiguous (especially if you keep 'closed' at the end, which I don’t recommend).
  • The fees group is contiguous (networkFee → peanutFee) in the array.

Also applies to: 33-33, 41-41

src/components/TransactionDetails/TransactionDetailsReceipt.tsx (1)

619-629: Closed row border: consistent with change above.

If you remove 'closed' from dateRows (recommended), leaving shouldHideBorder('closed') here is correct. If you instead move 'closed' next to 'completed' in the keys array, consider using shouldHideGroupBorder('closed','dateRows') for consistency.

@Zishan-7 Zishan-7 merged commit 7d01d46 into peanut-wallet-dev Oct 27, 2025
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants