From cf10b2a1a091662c6d3268110745267e753c3f69 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Mon, 23 Jan 2023 16:04:11 -0600 Subject: [PATCH] Fix #17300, #16843 - Use proper source for image of IPFS NFTs (#17302) --- .../app/collectible-details/collectible-details.js | 5 ++++- .../confirm-page-container-summary.component.js | 10 ++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ui/components/app/collectible-details/collectible-details.js b/ui/components/app/collectible-details/collectible-details.js index 78dffbe0c..0c198a58c 100644 --- a/ui/components/app/collectible-details/collectible-details.js +++ b/ui/components/app/collectible-details/collectible-details.js @@ -175,7 +175,10 @@ export default function CollectibleDetails({ collectible }) { className="collectible-details__card" > {image ? ( - + ) : ( )} diff --git a/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js index ace2c3ff7..ccb62846e 100644 --- a/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js +++ b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-summary/confirm-page-container-summary.component.js @@ -1,5 +1,7 @@ /* eslint-disable no-negated-condition */ import React, { useState } from 'react'; +import { useSelector } from 'react-redux'; + import PropTypes from 'prop-types'; import classnames from 'classnames'; @@ -7,6 +9,7 @@ import { TransactionType } from '../../../../../../shared/constants/transaction' import { toChecksumHexAddress } from '../../../../../../shared/modules/hexstring-utils'; import { useI18nContext } from '../../../../../hooks/useI18nContext'; import useAddressDetails from '../../../../../hooks/useAddressDetails'; +import { getIpfsGateway } from '../../../../../selectors'; import Identicon from '../../../../ui/identicon'; import InfoTooltip from '../../../../ui/info-tooltip'; @@ -15,6 +18,7 @@ import Typography from '../../../../ui/typography'; import { TYPOGRAPHY } from '../../../../../helpers/constants/design-system'; import { ORIGIN_METAMASK } from '../../../../../../shared/constants/app'; import SiteOrigin from '../../../../ui/site-origin'; +import { getAssetImageURL } from '../../../../../helpers/utils/util'; const ConfirmPageContainerSummary = (props) => { const { @@ -35,6 +39,7 @@ const ConfirmPageContainerSummary = (props) => { const [showNicknamePopovers, setShowNicknamePopovers] = useState(false); const t = useI18nContext(); + const ipfsGateway = useSelector(getIpfsGateway); const contractInitiatedTransactionType = [ TransactionType.contractInteraction, @@ -62,12 +67,14 @@ const ConfirmPageContainerSummary = (props) => { const checksummedAddress = toChecksumHexAddress(contractAddress); const renderImage = () => { + const imagePath = getAssetImageURL(image, ipfsGateway); + if (image) { return ( ); } else if (contractAddress) { @@ -76,7 +83,6 @@ const ConfirmPageContainerSummary = (props) => { className="confirm-page-container-summary__icon" diameter={36} address={contractAddress} - image={image} /> ); }