Skip to content

Conversation

pchrysochoidis
Copy link
Contributor

@pchrysochoidis pchrysochoidis commented Mar 21, 2023

Description

  • nfts page show only objects that define the display property
  • removes any other support for nft metadata
before after
Screenshot 2023-03-21 at 22 51 05 Screenshot 2023-03-21 at 22 46 19
Screen.Recording.2023-03-22.at.01.53.42.mov

Test Plan

manual testing


Type of Change (Check all that apply)

  • user-visible impact

Release notes

Sui wallet now supports NFT display standard. All other display nft metadata support is removed.

closes APPS-633

@vercel
Copy link

vercel bot commented Mar 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
explorer ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 24, 2023 at 7:28PM (UTC)
explorer-storybook ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 24, 2023 at 7:28PM (UTC)
sui-wallet-kit ❌ Failed (Inspect) Mar 24, 2023 at 7:28PM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
wallet-adapter ⬜️ Ignored (Inspect) Mar 24, 2023 at 7:28PM (UTC)

Copy link
Contributor

@Jordan-Mysten Jordan-Mysten left a comment

Choose a reason for hiding this comment

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

A small tweak on how we're approaching it. General idea looks good though.

@@ -54,6 +54,10 @@ const textStyles = cva([], {
true: 'truncate',
false: '',
},
multilineTruncate: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just put this on the parent node instead of in the text component?

}
}

export function processDisplay(display: Record<string, string> | null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't use this kind of pattern, given display data can include anything outside of these fields that we'll still display in some contexts. Would rather just handle the display fields piecemeal. This also aligns with our migration away from view-model-like processing of data (which this is closer to).

url: fields.url,
};
if (!is(details, SuiObjectData) || !details.display) return null;
return processDisplay(details.display);
Copy link
Contributor

Choose a reason for hiding this comment

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

If you nuke the processDisplay from core, you could just move it here basically, since this is already basically a view-model approach to this problem (which is fine for getting this out, just don't want to proliferate it by moving it to core).

import { useQuery, type UseQueryResult } from '@tanstack/react-query';

export function useGetObject(
objectId: string
objectId: string,
options?: SuiObjectDataOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just always fetch all the data for the sake of improved cache hits?

@@ -15,7 +15,7 @@ export function useOwnedNFT(
nftObjectId: string | null,
address: SuiAddress | null
) {
const data = useGetObject(nftObjectId!);
const data = useGetObject(nftObjectId || '', { showDisplay: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this is easy enough to get wrong that I'd prefer to just get all the data in the hook always.

@pchrysochoidis
Copy link
Contributor Author

@Jordan-Mysten I think I addressed your comments. Please have another look!

@mystie711
Copy link

On hover to expand description looks pretty good @pchrysochoidis.
I see that the ellipsis at the end is getting cut short by a dot. Bug?

Also, following up with you on slack about Object ID, Media Type addition.

@pchrysochoidis
Copy link
Contributor Author

@mystie711 I did the changes and updated the video in the description

Copy link

@mystie711 mystie711 left a comment

Choose a reason for hiding this comment

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

looking good.

Copy link
Contributor

@Jordan-Mysten Jordan-Mysten left a comment

Choose a reason for hiding this comment

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

Took a brief look, some nits, nothing super concerning, might have someone else take a deeper look

@@ -57,6 +57,7 @@
"@storybook/react": "7.0.0-rc.3",
"@storybook/react-webpack5": "7.0.0-rc.3",
"@storybook/theming": "7.0.0-rc.3",
"@tailwindcss/line-clamp": "^0.4.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Should we add this to core?

@@ -15,7 +15,7 @@ export function useOwnedNFT(
nftObjectId: string | null,
address: SuiAddress | null
) {
const data = useGetObject(nftObjectId!);
const data = useGetObject(nftObjectId || '');
Copy link
Contributor

Choose a reason for hiding this comment

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

This hook doesn't look like it handles nullable object IDs, instead of this defaulting we should update it to handle this properly


export type LabelValueItemProps = {
label: string;
value: ReactNode | LinkData;
Copy link
Contributor

Choose a reason for hiding this comment

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

Never a big fan of this type of variability.

* nfts page show only objects that define the display property
* removes any other support for nft metadata
@pchrysochoidis pchrysochoidis dismissed Jordan-Mysten’s stale review March 27, 2023 11:31

All comments are addressed - dismissing to unblock.

@pchrysochoidis pchrysochoidis merged commit 2db925b into main Mar 27, 2023
@pchrysochoidis pchrysochoidis deleted the pc-wallet-ext-apps-633-nfts-page branch March 27, 2023 11:32
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