Skip to content

Conversation

@Kahnchan
Copy link
Contributor

@Kahnchan Kahnchan commented Nov 14, 2025

Summary by CodeRabbit

  • New Features

    • Added protocol fee comparison display in swap service fee overview for better fee transparency.
  • Improvements

    • Enhanced perpetual trading position share visuals with refined colors, font sizes, and spacing.
    • Improved loading states with better skeleton and spinner presentations.
    • Updated icon sizing for improved visual consistency.
    • Added localized labels for exit prices and wallet fees.

@revan-zhang
Copy link
Contributor

revan-zhang commented Nov 14, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 14, 2025

Walkthrough

This pull request updates loading states and UI styling across Perp order book and position views, refactors position share rendering with responsive layouts and localization, introduces a protocol fee comparison component in Swap views, and adds corresponding translation enum members.

Changes

Cohort / File(s) Summary
Perp Order Book Loading States
packages/kit/src/views/Perp/components/OrderBook/DefaultLoadingNode.tsx, packages/kit/src/views/Perp/components/OrderInfoPanel/List/CommonTableListView.tsx, packages/kit/src/views/Perp/components/PerpOrderBook.tsx
Replaced dynamic skeleton rendering with fixed placeholders and spinner. Mobile loading now uses four simplified skeletons with varying widths or a centered spinner. Skeleton styling updated with adjusted dimensions and rounded radius.
Perp Positions Layout
packages/kit/src/views/Perp/components/OrderInfoPanel/Components/PositionsRow.tsx
Reduced icon button sizes from $4 to $3.5 in desktop and mobile header components.
Position Share Rendering & Styling
packages/kit/src/views/Perp/components/PositionShare/ShareContentRenderer.tsx, packages/kit/src/views/Perp/components/PositionShare/ShareImageGenerator.tsx, packages/kit/src/views/Perp/components/PositionShare/constants.ts
Enhanced responsive layouts with scaled gaps and font sizing. Added localization for exit price label. Enabled referral link text rendering. Updated color palette, font sizes, and spacing constants for improved visual hierarchy.
Swap Fee Comparison Feature
packages/kit/src/views/Swap/components/PreSwapInfoGroup.tsx, packages/kit/src/views/Swap/components/PreSwapInfoItem.tsx, packages/kit/src/views/Swap/components/ProtocolFeeComparisonList.tsx, packages/kit/src/views/Swap/components/SwapServiceFeeOverview.tsx
Introduced new ProtocolFeeComparisonList component for displaying protocol fees across wallets. Updated PreSwapInfoItem to accept ReactNode content. Refactored fee display to use new comparison list with visual progress bars and fee percentages.
Localization Enum
packages/shared/src/locale/enum/translations.ts
Added two new translation keys: perp_position_exit_price and provider_ios_popover_wallet_fee.

Sequence Diagram(s)

sequenceDiagram
    participant PreSwapInfoGroup
    participant PreSwapInfoItem
    participant ProtocolFeeComparisonList

    PreSwapInfoGroup->>PreSwapInfoGroup: Extract serviceFee from preSwapData
    PreSwapInfoGroup->>PreSwapInfoItem: Pass popoverContent (ReactNode: Stack + ProtocolFeeComparisonList)
    PreSwapInfoItem->>PreSwapInfoItem: Check if popoverContent is string or ReactNode
    alt String content
        PreSwapInfoItem->>PreSwapInfoItem: Render as SizableText
    else ReactNode content
        PreSwapInfoItem->>ProtocolFeeComparisonList: Render ReactNode directly
        ProtocolFeeComparisonList->>ProtocolFeeComparisonList: Merge otherWalletFeeData with oneKey entry
        ProtocolFeeComparisonList->>ProtocolFeeComparisonList: Calculate progress bar widths (fee/maxFee)
        ProtocolFeeComparisonList->>ProtocolFeeComparisonList: Render list with icons and fee percentages
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Areas requiring attention:

  • Position share layout calculations (ShareContentRenderer.tsx, ShareImageGenerator.tsx) — Verify responsive font scaling logic (0.06 vs. 0.045 per character) and gap multiplications work correctly across different text lengths.
  • New component prop type change (PreSwapInfoItem.tsx) — Confirm popoverContent type widening from string to string | React.ReactNode doesn't break existing uses.
  • Fee comparison data merging (ProtocolFeeComparisonList.tsx) — Validate that the combined list of otherWalletFeeData plus oneKey entry renders correctly and comparisons are semantically accurate.
  • Localization integration — Ensure new translation keys are properly registered and referenced in the image generation logic.

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.
Title check ❓ Inconclusive The title 'Fix/perp share interface' is vague and doesn't clearly convey the primary changes. The PR includes multiple unrelated fixes across OrderBook loading states, icon sizes, spinner layouts, font sizing, localization, and protocol fee comparisons. Use a more specific title that captures the main objective, such as 'Improve perp share interface styling and localization' or break into focused PRs by feature.
✅ 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

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.

…nd adjust token spacing in canvas configuration
@Kahnchan Kahnchan force-pushed the fix/perp-share-interface branch from fcdb935 to 85ee7dd Compare November 14, 2025 12:07
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: 6

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1a7e5d6 and a416a30.

⛔ Files ignored due to path filters (19)
  • packages/shared/src/locale/json/bn.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/de.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/en_US.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/es.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/fr_FR.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/hi_IN.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/id.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/it_IT.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/ja_JP.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/ko_KR.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/pt.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/pt_BR.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/ru.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/th_TH.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/uk_UA.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/vi.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/zh_CN.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/zh_HK.json is excluded by !packages/shared/src/locale/json/*.json
  • packages/shared/src/locale/json/zh_TW.json is excluded by !packages/shared/src/locale/json/*.json
📒 Files selected for processing (12)
  • packages/kit/src/views/Perp/components/OrderBook/DefaultLoadingNode.tsx (1 hunks)
  • packages/kit/src/views/Perp/components/OrderInfoPanel/Components/PositionsRow.tsx (2 hunks)
  • packages/kit/src/views/Perp/components/OrderInfoPanel/List/CommonTableListView.tsx (2 hunks)
  • packages/kit/src/views/Perp/components/PerpOrderBook.tsx (1 hunks)
  • packages/kit/src/views/Perp/components/PositionShare/ShareContentRenderer.tsx (6 hunks)
  • packages/kit/src/views/Perp/components/PositionShare/ShareImageGenerator.tsx (3 hunks)
  • packages/kit/src/views/Perp/components/PositionShare/constants.ts (2 hunks)
  • packages/kit/src/views/Swap/components/PreSwapInfoGroup.tsx (4 hunks)
  • packages/kit/src/views/Swap/components/PreSwapInfoItem.tsx (2 hunks)
  • packages/kit/src/views/Swap/components/ProtocolFeeComparisonList.tsx (1 hunks)
  • packages/kit/src/views/Swap/components/SwapServiceFeeOverview.tsx (2 hunks)
  • packages/shared/src/locale/enum/translations.ts (2 hunks)
🔇 Additional comments (13)
packages/kit/src/views/Perp/components/OrderInfoPanel/Components/PositionsRow.tsx (1)

380-380: LGTM! Icon size adjustment for visual consistency.

The share button icon size reduced from $4 to $3.5 in both desktop and mobile position rows. This is a minor UI refinement that improves visual balance.

Also applies to: 737-737

packages/kit/src/views/Perp/components/PerpOrderBook.tsx (1)

93-93: LGTM! Loading skeleton adjusted for better visual fit.

The skeleton width increased (120→180) and height decreased slightly (16→14), with rounded corners added. This aligns with the broader loading UI improvements across the PR.

packages/kit/src/views/Perp/components/OrderBook/DefaultLoadingNode.tsx (1)

178-183: LGTM! Simplified loading state is cleaner.

Replaced dynamic array mapping with 4 explicit skeletons (100%, 80%, 60%, 40% widths). The fixed sequence is more maintainable and aligns with the broader shift toward simplified loading indicators across Perp views.

Minor note: The MOBILE_ROWS constant (lines 58-76) is still defined but no longer used in this variant. Consider removing if it's not used elsewhere.

packages/kit/src/views/Perp/components/OrderInfoPanel/List/CommonTableListView.tsx (1)

21-21: LGTM! Cleaner loading state with centered spinner.

Replaced multiple skeleton placeholders with a single centered Spinner size="large". This simplifies the desktop list loading UI and aligns with the broader pattern of streamlined loading indicators across Perp views.

Also applies to: 562-567

packages/kit/src/views/Perp/components/PositionShare/constants.ts (1)

109-141: LGTM! Visual refinements improve share image readability.

Multiple constants updated for better typography and spacing:

  • Font sizes increased (side: 24→28, price labels/values: 25→28)
  • Spacing expanded (priceGap: 1.5→8, priceSpacingY: 40→50, tokenSpacing: 40→48)
  • Colors adjusted for better contrast (long green less bright, backgrounds darker, referral background more opaque)

The priceGap increase from 1.5 to 8 is the most significant change—verify that the larger gap between price labels and values looks good in the share images.

packages/kit/src/views/Swap/components/SwapServiceFeeOverview.tsx (1)

6-6: LGTM! Good refactor to dedicated component.

Extracted protocol fee list rendering to ProtocolFeeComparisonList. This improves code organization and reusability. The serviceFee calculation remains local and is passed as a prop.

Also applies to: 48-48

packages/kit/src/views/Perp/components/PositionShare/ShareContentRenderer.tsx (4)

90-90: LGTM! Less aggressive PnL font scaling.

Changed the scaling factor from 0.08 to 0.06 for long PnL text. This makes the font size reduction more gradual and maintains better readability.


231-231: LGTM! Gap scaling now responsive.

Both price display containers now multiply layout.priceGap by scale, making the gap responsive to different image sizes. This works in tandem with the increased priceGap constant (1.5→8) defined in constants.ts.

Also applies to: 263-263


273-275: LGTM! Exit price label now localized.

Replaced hardcoded "Exit Price" string with ETranslations.perp_position_exit_price. Good i18n practice.


320-331: LGTM! Referral label text re-enabled with localization.

The referral section now renders the localized "Referral Link" label above the URL. Gap increased to use the responsive layout.priceGap * scale pattern. This improves clarity and consistency with other price displays.

packages/kit/src/views/Perp/components/PositionShare/ShareImageGenerator.tsx (2)

240-247: Good: localized exit price label.

Switching to ETranslations.perp_position_exit_price aligns with i18n usage.


311-317: Good: show localized referral link label.

Matches existing ETranslations.referral_referral_link usage.

packages/shared/src/locale/enum/translations.ts (1)

2246-2246: Verify locale translations were synced for new keys.

The enum keys are defined (lines 2246, 2591) and in-use, but locale JSON files don't exist in the repo—they're generated via yarn fetch:locale. Before merging, confirm these new keys exist in your external translation source for all 21 supported locales: bn, de, en, en-US, es, fr-FR, hi-IN, id, it-IT, ja-JP, ko-KR, pt, pt-BR, ru, th-TH, uk-UA, vi, zh-CN, zh-HK, zh-TW.

@limichange limichange enabled auto-merge (squash) November 14, 2025 13:24
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.

3 participants