Skip to content

Commit

Permalink
web(profile): fallback for some NFTs without image_url
Browse files Browse the repository at this point in the history
  • Loading branch information
junhoyeo committed Aug 27, 2022
1 parent d7165d9 commit 9f43ed4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions packages/bento-web/src/dashboard/components/TokenDetailModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,22 @@ export const TokenDetailModal: React.FC<Props> = ({
{assets.map((asset) => {
const isVideo =
!!asset.animation_url ||
asset.image_url.toLowerCase().endsWith('.mp4');
asset.image_url?.toLowerCase()?.endsWith('.mp4') ||
false;

return (
<AssetListItem key={asset.id}>
<AssetMedia
src={!isVideo ? asset.image_url : asset.animation_url}
poster={asset.image_url || asset.image_preview_url}
src={
!isVideo
? asset.image_url || asset.collection.image_url
: asset.animation_url
}
poster={
asset.image_url ||
asset.image_preview_url ||
asset.collection.image_url
}
isVideo={isVideo}
/>
<AssetName className="text-sm text-gray-400">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@ export const NFTSection: React.FC<Props> = ({ nftAssets }) => {
nftAssets.map((asset) => {
const isVideo =
!!asset.animation_url ||
asset.image_url.toLowerCase().endsWith('.mp4');
asset.image_url?.toLowerCase()?.endsWith('.mp4') ||
false;

return (
<AssetListItem key={asset.id}>
<AssetMedia
src={!isVideo ? asset.image_url : asset.animation_url}
poster={asset.image_url || asset.image_preview_url}
src={
!isVideo
? asset.image_url || asset.collection.image_url
: asset.animation_url
}
poster={
asset.image_url ||
asset.image_preview_url ||
asset.collection.image_url
}
isVideo={isVideo}
/>
<AssetName className="text-sm text-gray-400">
Expand Down

0 comments on commit 9f43ed4

Please sign in to comment.