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

refactor asset-list-item to use list-item component #8725

Merged
merged 3 commits into from
Jun 3, 2020

Conversation

brad-decker
Copy link
Contributor

@brad-decker brad-decker commented Jun 2, 2020

Refactors the asset-list-item and token-cell to rely on the list-item
component for UI. Little changes were needed to the list-item code
to make this work!

Refactors the asset-list-item and token-cell to rely on the list-item
component for UI. Little changes were needed to the list-item code
to make this work! The result should be lots of eliminated code
@brad-decker brad-decker mentioned this pull request Jun 2, 2020
@metamaskbot
Copy link
Collaborator

Builds ready [0365fae]
Page Load Metrics (586 ± 58 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint29483652
domContentLoaded33570858412258
load33771358612258
domInteractive33570758412258

@brad-decker brad-decker marked this pull request as ready for review June 2, 2020 22:51
@brad-decker brad-decker requested a review from a team as a code owner June 2, 2020 22:51
numberOfDecimals: 2,
conversionRate: currentTokenToFiatRate,
})
formattedFiat = `${formatCurrency(currentTokenInFiat, currentCurrency)} ${currentCurrency.toUpperCase()}`
Copy link
Member

Choose a reason for hiding this comment

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

Previously this would omit fiat altogether if the value was zero, e.g. $0.

I think that's still something we want to do? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Speaking only from my personal preference: I like having it say $0.00 when token quantity is 0. It creates symmetry with other non zero balance tokens.

Copy link
Member

@Gudahtt Gudahtt Jun 3, 2020

Choose a reason for hiding this comment

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

Even when the conversion rate is missing? A side-effect of the old logic was that the fiat was hidden in the case where the information required to convert it was missing.

Showing $0.00 for a token worth a non-zero amount does seem misleading. Perhaps you could update this to hide the fiat balance if the conversion rate is missing, instead of when it's zero.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the conversion rate is missing, currentTokenInFiat never gets set. My assumption was showFiat would be false when it tries to evaluate Boolean(currentTokenInFiat) in this case. Is that not correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh, are you saying conversionRate is missing not contractExchangeRates[address]?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, currentTokenToFiatRate in particular. I thought that the conversion rate defaulted to zero if it wasn't given? 🤔 Maybe that's not the case.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, got it. What if i changed:

if (contractExchangeRates[address]) {

to

if (conversionRate > 0 && contractExchangeRates[address]) {

Copy link
Member

Choose a reason for hiding this comment

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

That seems reasonable!

ui/app/components/app/token-cell/token-cell.js Outdated Show resolved Hide resolved
@metamaskbot
Copy link
Collaborator

Builds ready [17f645b]
Page Load Metrics (842 ± 88 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint37118672612
domContentLoaded503110884018388
load505111184218388
domInteractive502110884018388

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@metamaskbot
Copy link
Collaborator

Builds ready [1a79873]
Page Load Metrics (626 ± 43 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint29413542
domContentLoaded3597076249043
load3617096269043
domInteractive3597066249043

@brad-decker brad-decker merged commit 591d84d into develop Jun 3, 2020
@brad-decker brad-decker deleted the asset-page-use-list-item branch June 3, 2020 17:50
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