Code Monkey home page Code Monkey logo

nft-components's Introduction

๐Ÿ’… @zoralabs/nft-components

Zora's NFT components allow you to easily create your own gallery or auction house with zNFT infrastructure.

This library provides the front-end display components on top of the @zoralabs/nft-hooks data-fetching library;

This library works alongside the Zora auction house (code) allows for DAOs and individuals to run their own decentralized auction house. Arbitrary NFTs across a wide variety of contract implementations are supported.

โœจ view docs on storybook โ†’

NFT Components

These components allow for drop-in rendering of NFTs. They work on the frontend and do not need any server-side components. These components are aware of both ongoing auctions and the perpetual markets for zNFTs, integrating latest bid information and other relevant marketplace information. They also handle most all of the same media types that the Zora marketplace natively handles (audio, video, image, HTML, and text). The components can be modified as needed and should be used as a prototype look and feel. Under the hood, they use the @zoralabs/nft-hooks library to retrieve data, if more customization is needed for the look and feel of the components the underlying data can be retrieved directly.

Main components:

Key Features:

Quickstart

  1. Install package:
yarn add @zoralabs/nft-components
  1. Render a NFT Thumbnail:
import { NFTPreview } from "@zoralabs/nft-components";

export const Page = () => <NFTPreview id="3002" />;
  1. Render a NFT Full page:
import { NFTFullPage } from "@zoralabs/nft-components";

export const Page = () => <NFTFullPage id="3002" />;
  1. Render a list of auctions for a curator:
import { NFTFullPage } from "@zoralabs/nft-components";

export const Page = ({curatorId}: {curatorId: string}) => (
    <AuctionHouseList
      onClick={(_, auction) => alert(`Clicked token ${auction.tokenId}`)}
      curatorIds={[curatorId]}
    />
);
  1. Render a proposed auction:
import { NFTProposal } from "@zoralabs/nft-components";

export const Page = () => <NFTProposal id="3002" />;

nft-components's People

Contributors

almndbtr avatar bjfresh avatar dblodorn avatar iainnash avatar jam516 avatar javamonn avatar neokry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nft-components's Issues

NFT-Components Doesn't Work with React 18 because package is shipping React 17 to users

After importing @zora/nft-components package in https://github.com/benschac/create-zora-graphql-app/ I got an error.

Unhandled Runtime Error
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.

Which 3 seemed like the likely culprit.

I then: npm ls react and confirmed @zora/nft-components was the only package that shipped with react v.17

[email protected] /Users/benjaminschachter/zora-hack
โ”œโ”€โ”ฌ @apollo/[email protected]
โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”œโ”€โ”ฌ @rainbow-me/[email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”‚ โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚ โ”‚   โ””โ”€โ”€ [email protected] deduped
โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”œโ”€โ”ฌ @zoralabs/[email protected]
โ”‚ โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚   โ””โ”€โ”€ [email protected] deduped
โ”œโ”€โ”ฌ @zoralabs/[email protected]
โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚   โ””โ”€โ”€ [email protected]
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ””โ”€โ”ฌ [email protected]
โ”‚   โ””โ”€โ”€ [email protected] deduped
โ”œโ”€โ”ฌ [email protected]
โ”‚ โ””โ”€โ”€ [email protected] deduped
โ”œโ”€โ”€ [email protected]
โ””โ”€โ”ฌ [email protected]
  โ”œโ”€โ”ฌ @wagmi/[email protected]
  โ”‚ โ””โ”€โ”ฌ [email protected]
  โ”‚   โ””โ”€โ”€ [email protected] deduped
  โ”œโ”€โ”ฌ [email protected]
  โ”‚ โ””โ”€โ”€ [email protected] deduped
  โ”œโ”€โ”€ [email protected] deduped
  โ””โ”€โ”ฌ [email protected]
    โ””โ”€โ”€ [email protected] deduped
    ```
    
    
 To test that `@zora/nft-components` was the culprit I added [selective version resolutions](https://classic.yarnpkg.com/en/docs/selective-version-resolutions/) and bumped `@zora/nft-components` to v18 with the rest of my project.
 
 https://github.com/benschac/create-zora-graphql-app/blob/main/package.json#L25
 
 Now the components work and the page is loading.
 
 The simplest solution here seems to not ship a version of react with `@zora/nft-components`

Video renderer enhancements

  • Progress Bar: allow scrubbing, jumping in time. For longer videos especially a narrative or music video (for example) this would be a nice addition.
  • Loading state: Make same aspect ratio (size) as media object.

Understand many nft's are video loops so not meant to be scrubbed, so perhaps progress bar becomes visible while hovering at bottom of video container.

FullComponents AuctionInfo to show market info once auction is over.

Currently when using the FullComponents.AuctionInfo component shows sold for info inconsistently:
I believe this is located to NFT Components and not the Iframe Embed codebase.

Perhaps we should revisit this component, and add some config options for what it renders for different market states.

Not showing here:
https://embed.zora.co/config/0x364547ADfc7a180744D762056Df35eeaEa803EC4/1

Although showing here:
https://embed.zora.co/config/foundation/105683

Screen Shot 2021-11-30 at 5 15 08 PM

Screen Shot 2021-11-30 at 5 11 13 PM

Screen Shot 2021-11-30 at 5 11 58 PM

Docs: typo in Custom Media Components

๐Ÿ”ฌ In src/stories/CustomMediaObjects.stories.mdx, I found a typographical error at the end of this sentence:

These components can be upgraded or overrideen.

I will open a PR to address this!

a11y audit

Audit components (especially media players) for a11y support.

Utilize new media properties from NFTObject in RenderRequest

New. media properties in NFTObject allow us to use mediaEncodings from Zora API

media?: {
    mimeType?: string;
    source: MEDIA_SOURCES;
    image?: MediaObject;
    large?: MediaObject;
    poster?: MediaObject;
    thumbnail?: MediaObject;
    // backwards compatibility
    content?: MediaObject;
  };

We should be surfacing these new properties in RenderRequest so they can be used in renderers. Current RenderRequest only surfaces these properties:

 media: {
    // from zora content uri
    content?: MediaUriType;
    image?: MediaUriType;
    // from metadata.animation_url
    animation?: MediaUriType;
  };

NFTPreview / video

Hello zora,

  1. great job. thanks for all the tooling you open source and the visual design is just bonkers.
  2. I can't access the discord anymore cause my phone number is taken, which worries me a little bit. currently I would really need the dev discord

My main problem is:
This is the collection I want to show on our website

The fetching with the zora zdk works properly but the NFTPreview shows me "unknown".
Here is a link to the codesandbox. With the parameters you give in the storybook the video preview works but it simply doesn't work for the NFTs I want to show. Any idea what might cause the issue.

EDIT (18. Jul 2022): I get a preview now of the NFT โ€“ see codesandbox.

  1. Is it possible to integrate buy now on the page and not to link to zora marketplace? I know there "place-bid" hooks which allow this functionality.
  2. The preview is still image only not the video if there is a video: NFTPreview and FullPage have the same issue โ€“ only show picture preview.

Happy Monday from Vienna

Skeleton Loaders

Some skeleton loader ui for media and some of the other components that currently show ...

Update to React 18

Many projects like Vite are on 18, and that makes it not compatible with this library. Could you please update to React 18.

Supporting Safari on iOS

We're not having luck with the NFTPreview component working in Safari on iOS for rabbithole.gg. It is working on desktop.

<MediaConfiguration
  networkId={networkId}
  style={styleOverride(true)}
>
  <NFTPreview
    id={id}
    showBids={false}
    refreshInterval={5000}
    href={`https://zora.co/${data?.nft?.creator}/${data?.nft?.tokenId}`}
  />
</MediaConfiguration>

pulse-image-1638393222838

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.