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

📊 Single asset page data #310

Merged
merged 10 commits into from
Oct 8, 2021
Merged

📊 Single asset page data #310

merged 10 commits into from
Oct 8, 2021

Conversation

henryboldi
Copy link
Contributor

@henryboldi henryboldi commented Oct 3, 2021

Single asset page data

Fills out this single asset page with real data, which opens by clicking on an asset from the home/wallet tab. Currently, this works by filtering the data by the asset symbol (ETH, for example), but this solution will not work once we're multi-network. Having a robust sense of unique IDs would clear this up.

Asset Page Data

(cherry picked from commit e7d3599)
⚠️ I should not be using the asset symbol as an id, and the filtering could be done smarter as a selector

(cherry picked from commit 155fdaf)
@henryboldi henryboldi marked this pull request as ready for review October 4, 2021 15:30
@mhluongo mhluongo requested a review from Shadowfiend October 6, 2021 00:28
Copy link
Contributor

@mhluongo mhluongo left a comment

Choose a reason for hiding this comment

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

A couple quick questions. Will leave the next review to @Shadowfiend or @itsrachelfish

<div>
<div className={`icon${isActive ? " active" : ""}`} />
</div>
<div className={`icon${isActive ? " active" : ""}`} />
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big thing, but can't we use classnames to make this a little cleaner? Maybe it doesn't come up enough in this codebase to warrant it

Copy link
Contributor

@greg-nagy greg-nagy Oct 7, 2021

Choose a reason for hiding this comment

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

I would be fine with this solution as this is plain js and not that hard to understand

as for classnames I had to check the package page, what it does, unerdstand some extra logic for functionality that is mostly not used here

Copy link
Contributor

Choose a reason for hiding this comment

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

It's a common React pattern 🤷‍♂️

I agree this is simple. String interpolation always is until it isn't 😁

Copy link
Contributor

Choose a reason for hiding this comment

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

@minutuslausus Just to clarify the decision here: we do use classnames, and it is the correct consistent solution across our codebase for any conditional class name handling. I think this particular piece just predated that decision, and we didn't do a wholesale migration when we added classnames to the mix.

Copy link
Contributor

Choose a reason for hiding this comment

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

@Shadowfiend get it now, thanks for the explanation

also I will need to tune my language processor to understand Matt's polite communication style better

@@ -15,6 +15,7 @@ interface Props {

export default function WalletActivityListItem(props: Props): ReactElement {
const { onClick, activity } = props
if (!activity.value || !activity.timestamp) return <></>
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, what's the idea here? What if value is 0 and there's no timestamp because a block couldn't be loaded?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unless I'm mistaken, value is a string, so I believe "0" would pass.

I've now tweaked it to check if value is undefined. Granted, in theory, it's redundant given the types. I've also moved the timestamp check to before formatting it, so just the timestamp part is missing when unavailable.

@greg-nagy
Copy link
Contributor

greg-nagy commented Oct 7, 2021

What is the purpose of PR reviews?

  • codereview / structure and nameing and sanity checks
  • or also a kind of smoke test so that only working version gets merged?

These are the errors that I am getting. Most of these I are comming from the BigInt issue

(I was following the code path for Matt's activity question but faced these errors)
The code I was running is the HEAD of asset-page-data branch

CleanShot 2021-10-07 at 12 09 25

@greg-nagy
Copy link
Contributor

greg-nagy commented Oct 7, 2021

@henryboldi I have read in one of the commit messages that the asset symbol names should not be used as index.

Why does it seem to be a bad idea? Can they change?

I am asking this so I understand the contstraints better

(also I think it's absolutely fine to implement the filter method the way you did)

greg-nagy
greg-nagy previously approved these changes Oct 7, 2021
Copy link
Contributor

@greg-nagy greg-nagy left a comment

Choose a reason for hiding this comment

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

if the purpose of the PR review is code sanity, nameing etc then I think this is a good PR

the commit history is awesome, and the implementation seems to be appropriate

my only concern is that the code in this branch is not working mainly due to the BigInt issue and probably because it's a bit old. If this not in the scope of the PR review then I am good with this change

@henryboldi
Copy link
Contributor Author

Thank you for the review, @minutuslausus! By the way, I don't believe any of those errors originate from these changes, but they're important to flag nonetheless!


@henryboldi I have read in one of the commit messages that the asset symbol names should not be used as index.

Why does it seem to be a bad idea? Can they change?

Primarily, asset symbol names shouldn't be used as IDs because they don't distinguish between different networks. For example, say you have 100 DAI on Polygon and 140 DAI on Mainnet. The UI wouldn't be able to distinguish those using only the token symbol.

@@ -12,7 +13,7 @@ export default function TabBarIcon(props: Props): ReactElement {
return (
<>
<Link to={`/${name}`}>
<div className={`icon${isActive ? " active" : ""}`} />
<div className={classNames("icon", { active: isActive })} />
Copy link
Contributor

Choose a reason for hiding this comment

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

just a quick note that if a new class needs to be added I would put this in a separate variable to make it easier to understand

but usually 2+ is where I draw the line in refactor so I think it's ok like this

Copy link
Contributor

@greg-nagy greg-nagy left a comment

Choose a reason for hiding this comment

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

added 2 smaller notes, but overall I think these changes should be good

thank you for the updates! :)

@henryboldi henryboldi merged commit 853565b into main Oct 8, 2021
@henryboldi henryboldi deleted the asset-page-data branch October 8, 2021 15:27
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.

4 participants