Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aum / GRWT-5056 /product-types-list #68

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

aum-deriv
Copy link
Contributor

@aum-deriv aum-deriv commented Mar 7, 2025

Summary by Sourcery

Introduces a Trade Types List component to allow users to switch between different trading modes. It also includes a skeleton component for loading states, improves the UI, and fixes a balance API endpoint.

New Features:

  • Adds a TradeTypesListController component that fetches and displays available trade types as a tab list.
  • Implements a Skeleton component for visual placeholders during loading states.
  • Adds a product service to fetch available trading products from the API.
  • Adds a new endpoint to get the balance

Tests:

  • Adds a test file for the product service

Copy link

sourcery-ai bot commented Mar 7, 2025

Reviewer's Guide by Sourcery

This pull request introduces a Trade Types List component, improves the UI with a Skeleton component and other styling updates, fixes a balance API endpoint, and updates guide configurations. It also includes a new product service and updates build configurations.

Updated class diagram for TradeState

classDiagram
    class TradeState {
        duration: string
        allowEquals: boolean
        trade_type: TradeType
        tradeTypeDisplayName: string
        instrument: string
        payouts: object
        contractDetails: ContractDetails | null
        setDuration(duration: string): void
        toggleAllowEquals(): void
        setPayouts(payouts: object): void
        setInstrument(instrument: string): void
        setTradeType(trade_type: TradeType, display_name?: string): void
        setTradeTypeDisplayName(displayName: string): void
        setContractDetails(details: ContractDetails): void
    }

    note for TradeState "Added tradeTypeDisplayName and setTradeTypeDisplayName method"
Loading

File-Level Changes

Change Details Files
Introduced a Trade Types List component to allow users to switch between different trading modes.
  • Added a TradeTypesListController component that fetches and displays available trade types as a tab list.
  • Implemented a Skeleton component for visual placeholders during loading states.
  • Added a product service to fetch available trading products from the API.
  • Modified the MarketInfo component to accept dynamic subtitles.
  • Updated the TradeStore to manage trade type display names.
src/screens/TradePage/components/README.md
src/screens/TradePage/TradePage.tsx
src/screens/TradePage/__tests__/TradePage.test.tsx
src/stores/tradeStore.ts
src/components/MarketInfo/MarketInfo.tsx
src/screens/TradePage/components/TradeTypesListController.tsx
src/services/api/rest/product/service.ts
src/services/api/rest/product/README.md
src/components/ui/skeleton.tsx
src/services/api/rest/product/__tests__/service.test.ts
Improved UI components and layout.
  • Added a Skeleton component for visual placeholders during loading states.
  • Updated TabList component styles and functionality.
  • Modified the SideNav component's appearance and structure.
  • Adjusted the MainLayout component to accommodate new UI elements.
  • Refactored the Header component into a ResponsiveHeader component.
  • Updated the AccountSwitcher component's styling.
  • Enhanced the DurationController component's layout.
  • Improved the styling of the TradeButton component.
  • Updated the styling of the Sidebar component.
src/components/ui/README.md
src/components/SideNav/SideNav.tsx
src/layouts/MainLayout/MainLayout.tsx
src/layouts/MainLayout/ResponsiveHeader.tsx
src/components/ui/tab-list.tsx
src/components/Duration/DurationController.tsx
src/components/AccountSwitcher/AccountSwitcher.tsx
src/components/Sidebar/Sidebar.tsx
tailwind.config.cjs
Fixed a balance API endpoint.
  • Updated the balance API endpoint in the fetchBalance function.
src/services/api/rest/balance/service.ts
Updated the guide configuration and HowToTrade component.
  • Updated the guide configuration to use rise_fall instead of rise-fall.
  • Modified the HowToTrade component to dynamically display the trade type.
  • Updated the GuideModal component to use the correct trade type.
  • Updated the bottom sheet configuration to use the correct trade type.
src/config/guideConfig.tsx
src/components/HowToTrade/HowToTrade.tsx
src/components/HowToTrade/GuideModal.tsx
src/config/bottomSheetConfig.tsx
src/components/HowToTrade/__tests__/HowToTrade.test.tsx
Updated build configurations.
  • Added cleanDistPath to rsbuild config.
rsbuild.config.ts
Added a new logo.
  • Added a new logo.
public/logo.svg

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

github-actions bot commented Mar 7, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @aum-deriv - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The new TradeTypesListController component introduces a good separation of concerns by handling the fetching and display of trade types.
  • Consider adding a more robust error handling mechanism, perhaps displaying a retry button or a more informative error message.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link

@devloai devloai bot left a comment

Choose a reason for hiding this comment

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

I've reviewed the Product Types List implementation and found it to be a solid addition that enables dynamic fetching and display of available product types. The implementation is generally well-structured, but I've identified several areas for improvement related to error handling, code quality, and test accuracy. The suggested changes will improve the robustness and reliability of the feature while maintaining its core functionality.

Copy link

cloudflare-workers-and-pages bot commented Mar 7, 2025

Deploying champion-trader with  Cloudflare Pages  Cloudflare Pages

Latest commit: e12d3e8
Status: ✅  Deploy successful!
Preview URL: https://98427dea.champion-trader.pages.dev
Branch Preview URL: https://aum-product-types-list.champion-trader.pages.dev

View logs

@aum-deriv
Copy link
Contributor Author

@sourcery-ai review

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @aum-deriv - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a more specific error message to the HowToTrade component when the guide content is not found.
  • The addition of the Skeleton component is great for improving the user experience during loading states.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@aum-deriv aum-deriv changed the title Aum/product types list Aum / GRWT-5056 /product-types-list Mar 7, 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