-
Notifications
You must be signed in to change notification settings - Fork 14
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
Farabi/fix switching in account switcher #43
Farabi/fix switching in account switcher #43
Conversation
Reviewer's Guide by SourceryThis pull request enhances the account switching functionality by adding support for demo accounts, updating UI elements to distinguish between demo and real accounts, and modifying the account data configuration. The changes include modifications to the AccountInfo and AccountSwitcher components, the useAccount hook, and the accountConfig file. Sequence diagram for resetting balance in a demo accountsequenceDiagram
participant User
participant AccountInfo Component
participant useClientStore Hook
User->>AccountInfo Component: Clicks "Reset balance" button
activate AccountInfo Component
AccountInfo Component->>useClientStore Hook: Calls setBalance("10000", "USD")
activate useClientStore Hook
useClientStore Hook-->>AccountInfo Component: Updates balance in store
deactivate useClientStore Hook
AccountInfo Component-->>User: Updates UI with reset balance
deactivate AccountInfo Component
Updated class diagram for AccountInfoclassDiagram
class AccountInfo {
+id: string
+displayName: string
+currency: string
+accountNumber: string
+isDemo?: boolean
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Dependency ReviewThe following issues were found:
OpenSSF ScorecardScorecard details
Scanned Manifest Filespackage-lock.json
package.json
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @farabi-deriv - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider using a more descriptive name than
isDemo
for the account type to improve readability. - The logic for determining the account type in
AccountSwitcher.tsx
could be simplified by directly checkingselectedAccount?.isDemo
.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Deploying champion-trader with
|
Latest commit: |
b21f73e
|
Status: | ✅ Deploy successful! |
Preview URL: | https://02091235.champion-trader.pages.dev |
Branch Preview URL: | https://farabi-fix--switching-in-acc.champion-trader.pages.dev |
This pull request includes several changes to enhance the account switching functionality and improve the user interface for demo and real accounts. The most important changes include adding support for demo accounts, updating UI elements to distinguish between demo and real accounts, and modifying the account data configuration.
Enhancements to account switching functionality:
src/components/AccountSwitcher/AccountInfo.tsx
: AddedsetBalance
touseClientStore
and updated theCurrencyIcon
component to accept anisVirtual
prop. Added a "Reset balance" button for demo accounts to reset the balance to 10000 USD. [1] [2] [3]src/components/AccountSwitcher/AccountSwitcher.tsx
: RemovedaccountType
and updated references to useselectedAccount
to determine if the account is a demo or real account. [1] [2]Updates to account data configuration:
src/config/accountConfig.ts
: AddedisDemo
property to theAccountInfo
interface and included a demo account in theaccountData
array.Modifications to account hooks:
src/hooks/useAccount.ts
: Removed unnecessary logic when switching account types and updated thegetAvailableAccounts
function to filter accounts based on theisDemo
property. [1] [2]Summary by Sourcery
Improves the account switching functionality by adding support for demo accounts and enhancing the user interface to differentiate between demo and real accounts. It also introduces a 'Reset balance' button for demo accounts.
New Features:
Enhancements:
isDemo
property.