-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
feat(mobile): staking view-only #14561
base: develop
Are you sure you want to change the base?
Conversation
29d45a5
to
65db415
Compare
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.
I need to test it more, but it looks nice from code :)
suite-native/accounts/src/components/AccountsList/AccountsListStakingItem.tsx
Show resolved
Hide resolved
suite-native/module-staking-management/src/components/StakingBalancesOverviewCard.tsx
Show resolved
Hide resolved
suite-native/module-staking-management/src/components/StakingBalancesOverviewCard.tsx
Show resolved
Hide resolved
suite-native/module-staking-management/src/components/StakePendingCard.tsx
Outdated
Show resolved
Hide resolved
suite-native/module-staking-management/src/components/StakePendingCard.tsx
Show resolved
Hide resolved
@@ -36,6 +37,12 @@ export const AccountSectionTitle: React.FC<AccountSectionTitleProps> = ({ | |||
adjustsFontSizeToFit | |||
value={fiatBalance} | |||
/> | |||
<CryptoAmountFormatter | |||
value={getCryptoBalanceWithStaking(account)} |
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.
What about creating selector for this?
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.
good idea, done
const shouldShowAccountLabel = !doesCoinSupportTokens || hideTokens; | ||
const shouldShowTokenBadge = accountHasAnyTokens && hideTokens; | ||
const shouldShowAccountLabel = !doesCoinSupportTokens || hideBadges; | ||
const shouldShowTokenBadge = accountHasAnyTokens && hideBadges; |
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.
The naming is confusing. I would expect it to be
const shouldShowTokenBadge = accountHasAnyTokens && hideBadges; | |
const shouldShowTokenBadge = accountHasAnyTokens && !hideBadges; |
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.
Yea, it was confusing I renamed it and it should be more clear now
account, | ||
onPress, | ||
stakingCryptoBalance, | ||
hasBackground, | ||
isFirst, | ||
isLast, |
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.
nit: onPress, hasBackground, isFirst, isLast
does not have to be explicitly named here. Instead spreaded ...otherProps
value could be used and passed in a single line to AccountsListItemBase
.
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.
fixed
showDivider={!isLast} | ||
onPress={onPress} | ||
icon={<RoundedIcon name="piggyBankFilled" color="iconSubdued" />} | ||
title="Staking" |
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.
Please add translation string for this
export const getEverstakePool = (account?: Account) => { | ||
if (account?.networkType !== 'ethereum') { | ||
return undefined; | ||
export const getEverstakePool = (account?: Account | AccountInfo) => { |
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.
AccountInfo should be enough since it is a subset of Account
.
export const getEverstakePool = (account?: Account | AccountInfo) => { | |
export const getEverstakePool = (account?: AccountInfo) => { |
If you gonna change this, please change it across this whole file.
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.
I removed this type change completely, it is not needed.
})); | ||
|
||
const separatorStyle = prepareNativeStyle(utils => ({ | ||
borderBottomWidth: 1, |
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.
borderBottomWidth: 1, | |
borderBottomWidth: utils.borders.width,s.small | |
`` |
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.
fixed
import { StakingBalancesOverviewCard } from './StakingBalancesOverviewCard'; | ||
import { StakingUnavailableBottomSheet } from './StakingUnavailableBottomSheet'; | ||
|
||
const sectiontStyle = prepareNativeStyle(utils => ({ |
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.
typo
const sectiontStyle = prepareNativeStyle(utils => ({ | |
const sectionStyle = prepareNativeStyle(utils => ({ |
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.
fixed
</Text> | ||
|
||
<Button | ||
onPress={() => handleToggleBottomSheet(false)} |
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.
handleToggleBottomSheet(true)
is never used in this file. The argument seems to be redundant in context of this file. What about passing () => handleToggleBottomSheet(false)
from parent directly?
onPress={() => handleToggleBottomSheet(false)} | |
onPress={handleToggleBottomSheet} |
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.
good idea, fixed
@@ -0,0 +1,101 @@ | |||
import { NetworkSymbol } from '@suite-common/wallet-config'; |
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.
What about naming this file ethereumStakingSelectors.ts for better context?
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.
yea, sounds nice
case 'eth': | ||
case 'thol': | ||
case 'tsep': | ||
return selectVisibleDeviceEthereumAccountsWithStakingByNetworkSymbol(state, 'eth'); |
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.
make sure to return bool for type safety.
return selectVisibleDeviceEthereumAccountsWithStakingByNetworkSymbol(state, 'eth'); | |
return A.isNotEmpty(selectVisibleDeviceEthereumAccountsWithStakingByNetworkSymbol(state, 'eth')); |
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.
fixed
097a050
to
ee339ad
Compare
ee339ad
to
b14cbfd
Compare
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.
good job 👌
} else { | ||
showToast({ | ||
variant: 'warning', | ||
message: 'Staking is not available in this context.', |
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.
nit: If we expect this to ne visible to user, it would be good to add to intl
Description
As much as possible coin agnostic staking implementation for mobile app.
Known issue:
desktop
icon on Staking Details (we should introduce new icon set ASAP)Related Issue
Resolve #12187
Screenshots: