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
Extend tag attributes functionality for NFTs #3162
Extend tag attributes functionality for NFTs #3162
Conversation
RNBW-2832 Expiration / registration name traits are incorrectly displayed in NFT metadata
Maybe it is possible to have a generic solution to recognize if the trait value is not just a number. If this is not possible, we can have a semi-generic solution (eg, if the trait name is ending with “date” or "day"). Update: OpenSea gives us also a
|
RNBW-3140 We do not understand "Boosts" properties correctly in NFTs
I am not sure how popular it is, but according to docs: https://docs.opensea.io/reference/asset-object
We do not handle correctly those two: Example: https://opensea.io/assets/0x1301566b3cb584e550a02d09562041ddc4989b91/78 OpenSea: Rainbow: Obviously, they are not expressed correctly (aqua power, stamina increase): Should be Also, I think they should be the last ones in the order. RNBW-2840 Url is capitalized as a trait value
‘Httsp://‘ looks weird. Maybe we can even cut this begging at all? RNBW-3203 Impossible to disable long-press action on Tag component
While implementing timestamp conversion to date I noticed it is impossible to disable long-press action on a These are the components, can be seen in Unique Asset screen |
Hey! I converted to draft, after speaking with Tomek and Terry and listening to their remarks I decided to handle all of the fixes listed as "Fixes" once since they wanted some refactors anyway. |
Great job! I answered what I think I have enough context for. Hopefully others can help with the rest of the questions. |
max_value?: string | number; | ||
}; | ||
|
||
const UniqueTokenAttributeItem: React.FC<AttributeItemProps> = ({ |
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.
mmm, what's the purpose of this wrapper? Can't we just use Tag
instead in src/components/unique-token/UniqueTokenAttributes.tsx
?
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.
okay, I see, this is making this mapping. But I guess we can dot his directly in Tag
no?
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 think we could skip it in some way @terrysahaidak what do you think about it since right now it lost the logic it had before?
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.
Actually whatever Terry says I think it makes sense to leave that. Tag is a UI component and uses it's own naming that is very close to the visual part and is coherent with that. I think this mapping is actually not something huge and it is okay to have it to make Tah code more independent from OpenSea API. Let me know what 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.
what?
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.
We don't use tags in any other context. This is a component made purely for OpenSea API. If you want to do mapping anyway, it's ok, but why then not do it at the parent component level?
export interface UniqueAssetTrait { | ||
trait_type: string; | ||
value: string | number; | ||
display_type: string; |
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.
...text: string
?
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.
how about title
? I think this should be in trait. The doc is not exhaustive in types I guess?
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 is not in OpenSea docs, but I think we could add it as an optional if it gets returned
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 don't think anything else belongs here to be honest. We already have everything required, some of the trait values are renamed later mapped to something else in a tag
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 added max_value
since given commit history it was used byt it is not documented by opensea api docs. Since it is optional it shouldn't cause any problem being there.
typeof value === 'string' && | ||
value.toLocaleLowerCase().startsWith('https://') | ||
) { | ||
const newValue = value.toLowerCase().replace('https://', ''); |
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 don't mind this. I would merge this and if someone will complain, we can remove this ¯_(ツ)_/¯ .
Also, the URL should be pressable (and open the URL). Can you include this in the PR? I guess we should url?: string
to MappedTrait
and then use this in a Context menu
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.
Or just check in Tag
if the originalValue
is an URL and defer logic to there
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.
Yeah, good idea with opening the URL I will make sure to include it as well
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.
Actually I think there's more to this. The context menu says sth like "search for this trait on OpenSea" I think we should entirely change the context menu there, like to include open the URL option as well. We can make this a lot earlier I guess.
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.
const newValue = value.toLowerCase().replace('https://', ''); | |
const newValue = value.substring(8); |
This is what we actually want to do no?
… for menu visibility
…onent rendered conditionally
…ng of the tag list
…r know what will be opened and if they want to proceed
This reverts commit 0c37f46.
4694839
to
29bf3c8
Compare
/rebase |
Fixes RNBW-2832
Fixes RNBW-3140
Fixes RNBW-2840
Fixes RNBW-3203
What changed (plus any additional context for devs)
display_type: "date"
attribute from OpenSea API.display_type: "boost_number"
anddisplay_type: "boost_percentage"
)PoW (screenshots / screen recordings)
Before:
https://streamable.com/fa6lby
After:
https://streamable.com/0wy2fz
Dev checklist for QA: what to test
undefined display_type | null display_type | number display_type -> boost_percentage | boost_number display_type -> date display_type
Final checklist