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

O/noun 257 manage automated derivatives addition #153

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

olegakbarov
Copy link
Contributor

Attempt to simplify NFTGrid and NFTCard components: only necessary data, no dependency NFTObject

@linear
Copy link

linear bot commented Dec 7, 2022

NOUN-257 Manage (Automated derivatives addition)

Scope

  • "List for sale"
    • private sale flow
    • fixed price flow
  • "Manage listing" - reroutes to token page

----

Out of scope

  • Cancel listing
  • Manage listing
    • Update

@vercel
Copy link

vercel bot commented Dec 7, 2022

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

Name Status Preview Updated
nouns-marketplace ✅ Ready (Inspect) Visit Preview Dec 7, 2022 at 0:32AM (UTC)

@olegakbarov olegakbarov marked this pull request as draft December 7, 2022 00:32
<Stack gap="x14" pb="x10">
<Grid {...props} p="x0">
{items.map((nft) => {
const collectionAddress = nft.token.collectionAddress
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be able to destructure these from nft.token

Comment on lines +25 to +30
tokenId
collectionAddress
collectionName
tokenOwner
token?.image?.url or token?.image?.mediaEncoding?.poster
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

bye bye?

image: ImageType
}

export function NFTCard2({
Copy link
Contributor

Choose a reason for hiding this comment

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

Great that this eliminates the useNFTProvider() calls, which seemed to me like a super weird pattern.

image: any // very bad type from api, FIXME later
}

export function ImageWithNounFallback({
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this to an external component?

Comment on lines +78 to +93
const decodedImgSrc = useMemo(() => {
const imageUrl = image?.url
if (image?.mimeType === 'image/svg+xml') {
return imageUrl?.includes('data:image/svg+xml') ||
imageUrl?.includes('https://api.zora.co')
? imageUrl
: `data:image/svg+xml,${imageUrl}` // proper handling of URI-encoded SVG
} else {
return image?.mediaEncoding?.poster ?? imageUrl
}
}, [image])

const srcImg = useMemo(
() => decodedImgSrc ?? rawImageFallback,
[decodedImgSrc, rawImageFallback]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd suggest moving this all into useRawImageTransform

className={[titleWrapper, useTitleScroll && titleScroll]}
style={{
/* @ts-ignore-next-line */
'--titlePad': titleScroll ? '40px' : '0px',
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels like we can manage this inside of the stylesheet

}

export function NFTGrid2({ items, ...props }: NFTGridProps) {
console.log(items)
Copy link
Contributor

Choose a reason for hiding this comment

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

console

image,
tokenName,
}: Props) {
console.log('NFTCard2', collectionAddress, tokenId, collectionName)
Copy link
Contributor

Choose a reason for hiding this comment

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

console

Copy link
Contributor

@bjfresh bjfresh left a comment

Choose a reason for hiding this comment

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

Few suggestions, good to go when cleaned up. Nice work!

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.

2 participants