-
Notifications
You must be signed in to change notification settings - Fork 379
Sergei / wall 1837 / remove svg badge #10051
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
Sergei / wall 1837 / remove svg badge #10051
Conversation
…ub' into sergei/wall-xxx/refactor-hooks
…ub_2' into sergei/wall-xxx/refactor-hooks
…ub_2' into sergei/wall-xxx/refactor-hooks
…ub_2' into sergei/wall-xxx/refactor-hooks
…ub_2' into sergei/wall-xxx/refactor-hooks
…ub_2' into sergei/wall-1837/remove-svg-badge
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
A production App ID was automatically generated for this PR. (log)
Click here to copy & paste above information.
|
🚨 Lighthouse report for the changes in this PR:
Lighthouse ran with https://deriv-app-git-fork-sergei-deriv-sergei-wall-1837remove-s-431679.binary.sx/ |
landing_company_name: wallet.landing_company_name?.replace('maltainvest', 'malta'), | ||
/** Indicating whether the wallet is a maltainvest wallet. */ | ||
is_malta_wallet: wallet.landing_company_name === 'malta', | ||
is_malta_wallet: wallet.landing_company_name === 'maltainvest', |
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.
Note1: changed to maltainvest
because replace
function doesn't mutate original string and it's still maltainvest
, not malta
. Ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace
Note2: we don't use Jurisdiction
object from shared
package because hooks
package doesn't have shared
package as dependency
c78e534
to
8ae94ca
Compare
8ae94ca
to
cee3d6a
Compare
const { ui } = useStore(); | ||
const { is_dark_mode_on } = ui; | ||
|
||
const show_badge = wallet_account?.is_malta_wallet || wallet_account?.is_virtual; |
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.
@sergei-deriv add this logic to the parent of this component and make the badge an optional props so whenever you don't pass badge to it, it will be empty
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.
@mahdiyeh-deriv What do you think if I'll add this logic inside of the WalletBadge component?
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.
@mahdiyeh-deriv I have a suggestion, let's add show_badge
as prop to WalletBadge
component, in result it will be really dumb component and logic to show/hide the badge will be in his parent? What do you think?
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.
@sergei-deriv yes, let's make the badge component a dummy one without any logic in that
const icon_type = is_virtual ? 'demo' : currency_config?.type; | ||
const is_selected = is_active || linked_to?.some(account => account.loginid === active_account?.loginid); | ||
|
||
const show_badge = is_malta_wallet || is_virtual; |
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.
same here
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.
@mahdiyeh-deriv I'm not sure it's a good idea for this component (AccountSwitcherWalletItem
), because this component needs to show every item in dropdown and we call it in AccountSwitcherWallet
like this:
{dtrade_account_wallets?.map(account => (
<AccountSwitcherWalletItem
key={account.dtrade_loginid}
account={account}
closeAccountsDialog={closeAccountsDialog}
/>
))}
So we just pass account and define to show or not the badge inside of the component. In your suggestion we need to add the same logic in AccountSwitcherWallet inside of the map method. Do you think is it better?
I understand what you mean, you want a dummy component as possible, but in my opinion this logic related to only this component. Also, we already have a lot of logic to define app_icon, icon_type, selected item or not, so I don't see any problem to add the logic to define to show the badge or not, because it depends on account which we already pass to the component.
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.
It's fine, keep it here and remove form the children component
cee3d6a
to
16b833b
Compare
Kudos, SonarCloud Quality Gate passed! |
Changes:
Screenshots:
Screenshot from design:

Screenshot from localhost:
