diff --git a/explorer/src/components/common/NFTArt.tsx b/explorer/src/components/common/NFTArt.tsx index 1f200f075..b7feaa64f 100644 --- a/explorer/src/components/common/NFTArt.tsx +++ b/explorer/src/components/common/NFTArt.tsx @@ -30,6 +30,18 @@ const ErrorPlaceHolder = () => ( Solana Logo ); +const ViewOriginalArtContentLink = ({ src }: { src: string }) => { + if (!src) { + return null; + } + + return ( +
+ VIEW ORIGINAL +
+ ); +} + const CachedImageContent = ({ uri }: { uri?: string }) => { const [isLoading, setIsLoading] = useState(true); const [showError, setShowError] = useState(false); @@ -65,21 +77,26 @@ const CachedImageContent = ({ uri }: { uri?: string }) => { ) : ( <> {isLoading && } - {"nft"} { - setIsLoading(false); - }} - onError={() => { - setShowError(true); - }} - /> +
+ {"nft"} { + setIsLoading(false); + }} + onError={() => { + setShowError(true); + }} + /> + {uri && ( + + )} +
)} @@ -98,7 +115,6 @@ const VideoArtContent = ({ active?: boolean; }) => { const [playerApi, setPlayerApi] = useState(); - const playerRef = useCallback( (ref) => { setPlayerApi(ref); @@ -123,8 +139,8 @@ const VideoArtContent = ({ const content = likelyVideo && - likelyVideo.startsWith("https://watch.videodelivery.net/") ? ( -
+ likelyVideo.startsWith("https://watch.videodelivery.net/") ? ( +
playerRef(e)} src={likelyVideo.replace("https://watch.videodelivery.net/", "")} @@ -140,27 +156,33 @@ const VideoArtContent = ({ autoplay={true} muted={true} /> +
) : ( - - ); +
+ + {(likelyVideo || animationURL) && ( + + )} +
+ ) return content; }; @@ -172,7 +194,8 @@ const HTMLContent = ({ animationUrl?: string; files?: (MetadataJsonFile | string)[]; }) => { - const [loaded, setLoaded] = useState(false); + const [isLoading, setIsLoading] = useState(true); + const [showError, setShowError] = useState(false); const htmlURL = files && files.length > 0 && typeof files[0] === "string" ? files[0] @@ -180,22 +203,35 @@ const HTMLContent = ({ return ( <> - {!loaded && } - + {showError ? ( +
+ +
Error Loading Image
+
+ ) : ( + <> + {!isLoading && } +
+ + {htmlURL && ( + + )} +
+ + )} ); };