Skip to content

Conversation

@Artem1211
Copy link
Collaborator

@Artem1211 Artem1211 commented Nov 11, 2025

…ntent

Summary by CodeRabbit

  • New Features

    • Added in-app toast notifications (global toaster) for user-facing messages.
  • Bug Fixes / UX

    • Improved error handling in lending/liquidity flows with clearer, token-aware error toasts on failures.
    • Errors now propagate so failures surface reliably.
  • Chores

    • Added react-toastify dependency.
  • Changes

    • Removed the "Where can I get more info?" FAQ (newsletter/community links).
    • Market metrics now show precise (non-floored) amounts in tooltips and summaries.

@coderabbitai
Copy link

coderabbitai bot commented Nov 11, 2025

Walkthrough

Added react-toastify and a ToasterContainer; mounted the toaster in RootLayout; enhanced lend hook to show token-aware toast errors and fetch token decimals; changed liquidity hook to propagate errors; removed an FAQ block and DISCORD_LINK from the landing question component.

Changes

Cohort / File(s) Change Summary
Landing FAQ cleanup
packages/landing/src/widgets/landing/components/question-section/question-section.tsx
Removed DISCORD_LINK import and deleted the entire "Where can I get more info?" FAQ block (newsletter + Discord reference).
Toaster provider + dependency
packages/app/package.json, packages/app/src/global/providers/toaster-container.tsx, packages/app/src/app/layout.tsx
Added react-toastify dependency; added ToasterContainer client component; imported and rendered <ToasterContainer /> in RootLayout.
Lending hook — toast errors
packages/app/src/features/liquidity-flow/hooks/use-lend-increase.tsx
Added toast usage and useTokenInfo to fetch token decimals; wrapped deposit send in try/catch; parse numeric balance from error messages and show token-aware toast errors on balance-related failures.
Liquidity hook — error propagation
packages/app/src/features/liquidity-flow/hooks/use-liquidity.ts
Changed catch behavior to rethrow a new Error instead of returning false, allowing errors to propagate to callers.
Market card formatting tweak
packages/app/src/widgets/market-section/components/market-card/market-card.tsx
Replaced integer flooring of displayed amounts with direct (possibly fractional) values for totalSupplied and availableToBorrow in UI/tooltips.

Sequence Diagram(s)

sequenceDiagram
  participant U as User/UI
  participant H as useLendIncrease hook
  participant S as send(deposit) operation
  participant T as react-toastify API
  participant C as ToasterContainer (mounted)

  U->>H: submit deposit
  H->>S: call send(deposit)
  alt success
    S-->>H: success
    H-->>U: existing success flow
  else error
    S-->>H: throws error (may include numeric balance)
    H->>H: parse numeric balance using token decimals
    H->>T: toast.error("Insufficient balance: X tokens")
    T-->>C: enqueue toast
    C-->>U: display toast (bottom-right)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring attention:
    • Regex and numeric extraction and decimal scaling in use-lend-increase.tsx.
    • Correct client-only behavior and SSR implications for ToasterContainer and react-toastify.
    • Call sites of use-liquidity.ts that may expect false instead of thrown errors.
    • UI formatting change in market-card.tsx for numeric precision/display.

Suggested reviewers

  • artur-abliazimov

Poem

🐇 I hopped through lines with careful paws,
Removed a link and fixed the flaws,
A toaster waits for error cries,
Tokens speak with sharper eyes —
Crunchy carrots, quieter logs. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title check ⚠️ Warning The title claims to remove only the Discord link from QuestionSection, but the changeset includes significant additional changes: adding react-toastify integration, enhancing error handling in liquidity flow hooks, creating a toaster component, and modifying market card precision logic. Update the title to reflect all major changes, such as: 'refactor: add toast notifications and remove Discord link' or break into separate PRs with focused scopes.
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.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-wallet

📜 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 80b349a and c1b2e02.

📒 Files selected for processing (1)
  • packages/app/src/widgets/market-section/components/market-card/market-card.tsx (1 hunks)
⏰ 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). (4)
  • GitHub Check: test-build-image (app)
  • GitHub Check: test-build-image (landing)
  • GitHub Check: test-build-image (app)
  • GitHub Check: test-build-image (landing)
🔇 Additional comments (1)
packages/app/src/widgets/market-section/components/market-card/market-card.tsx (1)

59-60: Change is verified as sound—formatter properly handles decimal values.

The formatting chain fully supports decimal inputs. FORMAT_CRYPTO_CURRENCY_OPTIONS allows up to 2 decimal places, valueFormatSelector preserves precision through conversion and routing, and Intl.NumberFormat natively handles decimals. Removing the Math.floor() call enables displaying fractional token amounts with proper formatting, improving accuracy for users.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7fb29f2 and c79795d.

📒 Files selected for processing (1)
  • packages/landing/src/widgets/landing/components/question-section/question-section.tsx (1 hunks)
⏰ 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). (2)
  • GitHub Check: test-build-image (landing)
  • GitHub Check: test-build-image (app)
🔇 Additional comments (1)
packages/landing/src/widgets/landing/components/question-section/question-section.tsx (1)

5-5: LGTM! Import cleanup is correct.

The removal of DISCORD_LINK is consistent with the content changes, and NOTION_LINK is retained and properly used in the component.

Copy link

@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: 4

🧹 Nitpick comments (1)
packages/app/src/features/liquidity-flow/hooks/use-lend-increase.tsx (1)

36-38: Consider lazy-loading token decimals.

Fetching decimals for all three tokens unconditionally may be inefficient if only one token is used in the deposit operation.

Consider fetching decimals only when needed within the error handler:

-  const usdcDecimals = useTokenInfo('usdc').decimals;
-  const xlmDecimals = useTokenInfo('xlm').decimals;
-  const xrpDecimals = useTokenInfo('xrp').decimals;
-
   const depositSumUsd = useDepositUsd(position?.deposits);

Then in the error handler, fetch the specific token's decimals:

const tokenName = Object.keys(sendValue)[0] as SupportedTokenName;
const decimals = useTokenInfo(tokenName).decimals;

Note: This would require refactoring to avoid calling hooks conditionally. Alternatively, create a helper function outside the component that accepts decimals as parameters.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c79795d and 80b349a.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (5)
  • packages/app/package.json (1 hunks)
  • packages/app/src/app/layout.tsx (2 hunks)
  • packages/app/src/features/liquidity-flow/hooks/use-lend-increase.tsx (4 hunks)
  • packages/app/src/features/liquidity-flow/hooks/use-liquidity.ts (1 hunks)
  • packages/app/src/global/providers/toaster-container.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/app/src/app/layout.tsx (1)
packages/app/src/global/providers/toaster-container.tsx (1)
  • ToasterContainer (6-21)
packages/app/src/features/liquidity-flow/hooks/use-lend-increase.tsx (2)
packages/app/src/features/liquidity-flow/hooks/use-token-info.ts (1)
  • useTokenInfo (8-42)
packages/app/src/features/liquidity-flow/soroban/get-cell-by-position-update.tsx (1)
  • getCellByPositionUpdate (5-9)
⏰ 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). (4)
  • GitHub Check: test-build-image (landing)
  • GitHub Check: test-build-image (app)
  • GitHub Check: test-build-image (landing)
  • GitHub Check: test-build-image (app)
🔇 Additional comments (1)
packages/app/src/global/providers/toaster-container.tsx (1)

6-21: LGTM! Toast configuration is well-structured.

The ToastContainer configuration is appropriate with sensible defaults:

  • Bottom-right positioning is conventional
  • 5-second auto-close provides good UX
  • Draggable with horizontal direction enables user control
  • Close button gives explicit dismissal option

@Artem1211 Artem1211 closed this Nov 12, 2025
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.

2 participants