Skip to content

Conversation

kushagrasarathe
Copy link
Contributor

@kushagrasarathe kushagrasarathe commented Feb 3, 2025

fixes TASK-8571

Summary by CodeRabbit

  • New Features

    • Enhanced fee details now include additional information on banking charges, such as a 0.25% fee on cashout amounts.
    • Improved display of fee-related values for clearer user understanding.
    • Clarified fee descriptions by specifying "flat fee" for SEPA and ACH transactions.
  • Refactor

    • Updated fee computation to ensure consistent calculations across the payment and confirmation screens.
    • Enhanced formatting of slippage values for improved presentation.

Copy link

vercel bot commented Feb 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 4, 2025 2:53pm

Copy link
Contributor

coderabbitai bot commented Feb 3, 2025

Walkthrough

This pull request updates fee-related components by enhancing how fee information is calculated and displayed. The FeeDescription component now appends details about "Peanut fees" to the existing banking fee text. In the Offramp/Confirm.view.tsx, an inline fee calculation is refactored into a dedicated calculateBankingFee function, which is then used to ensure consistent fee computation. Additionally, the Initial.view.tsx modifies the formatting of the maxSlippage property using a utility function, refining its presentation without altering overall component logic.

Changes

File(s) Change Summary
src/components/Global/FeeDescription/index.tsx
src/components/Request/Pay/Views/Initial.view.tsx
Updated fee display components: In FeeDescription, the "Banking fee" text now includes additional "Peanut fees" details; In Initial.view.tsx, maxSlippage is now formatted with formatAmount.
src/components/Offramp/Confirm.view.tsx Introduced a new calculateBankingFee function to encapsulate fee computation logic and updated fee-related calls in the component to use this function for consistency.
src/components/Offramp/Success.view.tsx Restored imports and clarified fee display text in the MoreInfo component by changing "a fee of" to "a flat fee of".

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant O as OfframpConfirmView
    participant F as calculateBankingFee
    participant D as FeeDisplay (FeeDescription/InfoRow)

    U->>O: Initiate fee estimation
    O->>F: Calculate fee based on account type & promo
    F-->>O: Return computed fee
    O->>D: Pass fee for display (with additional "Peanut fees" info)
Loading

Possibly related PRs

Suggested reviewers

  • Hugo0
  • jjramirezn

Poem

I hopped through lines of code so bright,
Updating fees with a keen insight.
Peanut fees now dance in the display,
With functions that guide the fee's way.
A joyful hop to every new line,
Celebrating changes—oh, so fine!
🐰💻 Hop on, dear coder, hop on!

Tip

🌐 Web search-backed reviews and chat
  • We have enabled web search-based reviews and chat for all users. This feature allows CodeRabbit to access the latest documentation and information on the web.
  • You can disable this feature by setting web_search: false in the knowledge_base settings.
  • Please share any feedback in the Discord discussion.

📜 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 d0d9589 and fb3103c.

📒 Files selected for processing (2)
  • src/components/Global/FeeDescription/index.tsx (1 hunks)
  • src/components/Offramp/Success.view.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/Global/FeeDescription/index.tsx
🔇 Additional comments (1)
src/components/Offramp/Success.view.tsx (1)

6-7: LGTM!

The added imports are necessary and correctly used throughout the component.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@kushagrasarathe kushagrasarathe requested a review from Hugo0 February 3, 2025 19:48
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: 1

🧹 Nitpick comments (1)
src/components/Global/FeeDescription/index.tsx (1)

144-147: LGTM! Consider extracting fee constants.

The fee description is clear and informative. However, consider extracting the fee percentages and amounts into constants to improve maintainability.

Apply this diff to extract the fee constants:

+const PEANUT_FEE_PERCENTAGE = 0.25
+const SEPA_FEE = 1
+const ACH_FEE = 0.5
+
 moreInfoText={
     isPromoApplied
         ? 'Fees waived with promo code!'
         : (accountType === 'iban'
               ? `For SEPA transactions a fee of $${SEPA_FEE} is charged. For ACH transactions a fee of $${ACH_FEE} is charged.`
               : `For ACH transactions a fee of $${ACH_FEE} is charged. For SEPA transactions a fee of $${SEPA_FEE} is charged.`) +
           ` Peanut fees are ${PEANUT_FEE_PERCENTAGE}% of the cashout amount.`
 }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 53542f6 and d0d9589.

📒 Files selected for processing (3)
  • src/components/Global/FeeDescription/index.tsx (1 hunks)
  • src/components/Offramp/Confirm.view.tsx (4 hunks)
  • src/components/Request/Pay/Views/Initial.view.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/components/Request/Pay/Views/Initial.view.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
src/components/Offramp/Confirm.view.tsx

[error] 712-712: Avoid redundant double-negation.

It is not necessary to use double-negation when a value will already be coerced to a boolean.
Unsafe fix: Remove redundant double-negation

(lint/complexity/noExtraBooleanCast)

🔇 Additional comments (1)
src/components/Offramp/Confirm.view.tsx (1)

736-742: LGTM! Fee calculation updates are consistent.

The fee calculation updates consistently use the new calculateBankingFee function across all components. The function is properly memoized with useCallback for performance optimization.

Also applies to: 879-880, 908-912, 923-928

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.

No blocking issues, lgtm

@kushagrasarathe kushagrasarathe merged commit acb5ede into develop Feb 4, 2025
4 checks passed
@Hugo0 Hugo0 deleted the feat/peanut-fee branch July 3, 2025 18:23
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