From f5d0804c4629469323c07dfb81e6ebbc0f0b78a5 Mon Sep 17 00:00:00 2001 From: Jack Short Date: Thu, 13 Apr 2023 15:43:14 -0400 Subject: [PATCH] feat: creating feature flag for details v2 page (#6359) * feat: creating feature flag for details v2 page * eslint ignore * moving details v2 under trace --- .../FeatureFlagModal/FeatureFlagModal.tsx | 7 +++++ src/featureFlags/flags/featureFlags.ts | 1 + src/featureFlags/flags/nftDetails.ts | 11 ++++++++ src/nft/components/details/NftDetails.tsx | 14 ++++++++++ src/nft/pages/asset/Asset.tsx | 26 ++++++++++++------- 5 files changed, 49 insertions(+), 10 deletions(-) create mode 100644 src/featureFlags/flags/nftDetails.ts create mode 100644 src/nft/components/details/NftDetails.tsx diff --git a/src/components/FeatureFlagModal/FeatureFlagModal.tsx b/src/components/FeatureFlagModal/FeatureFlagModal.tsx index 3a099d2305..e47482152b 100644 --- a/src/components/FeatureFlagModal/FeatureFlagModal.tsx +++ b/src/components/FeatureFlagModal/FeatureFlagModal.tsx @@ -1,6 +1,7 @@ import { BaseVariant, FeatureFlag, featureFlagSettings, useUpdateFlag } from 'featureFlags' import { MgtmVariant, useMgtmFlag } from 'featureFlags/flags/mgtm' import { useMiniPortfolioFlag } from 'featureFlags/flags/miniPortfolio' +import { DetailsV2Variant, useDetailsV2Flag } from 'featureFlags/flags/nftDetails' import { NftGraphqlVariant, useNftGraphqlFlag } from 'featureFlags/flags/nftlGraphql' import { PayWithAnyTokenVariant, usePayWithAnyTokenFlag } from 'featureFlags/flags/payWithAnyToken' import { SwapWidgetVariant, useSwapWidgetFlag } from 'featureFlags/flags/swapWidget' @@ -235,6 +236,12 @@ export default function FeatureFlagModal() { featureFlag={FeatureFlag.nftGraphql} label="Migrate NFT read endpoints to GQL" /> + { + return ( +
+ Details page for {asset.name} from {collection.collectionName} +
+ ) +} diff --git a/src/nft/pages/asset/Asset.tsx b/src/nft/pages/asset/Asset.tsx index c87640eece..bd00ec2ac8 100644 --- a/src/nft/pages/asset/Asset.tsx +++ b/src/nft/pages/asset/Asset.tsx @@ -1,9 +1,11 @@ import { Trace } from '@uniswap/analytics' import { InterfacePageName } from '@uniswap/analytics-events' +import { useDetailsV2Enabled } from 'featureFlags/flags/nftDetails' import { useNftAssetDetails } from 'graphql/data/nft/Details' import { AssetDetails } from 'nft/components/details/AssetDetails' import { AssetDetailsLoading } from 'nft/components/details/AssetDetailsLoading' import { AssetPriceDetails } from 'nft/components/details/AssetPriceDetails' +import { NftDetails } from 'nft/components/details/NftDetails' import { useParams } from 'react-router-dom' import styled from 'styled-components/macro' @@ -37,11 +39,11 @@ const AssetPriceDetailsContainer = styled.div` const AssetPage = () => { const { tokenId = '', contractAddress = '' } = useParams() const { data, loading } = useNftAssetDetails(contractAddress, tokenId) + const detailsV2Enabled = useDetailsV2Enabled() const [asset, collection] = data - if (loading) return - + if (loading && !detailsV2Enabled) return return ( <> { properties={{ collection_address: contractAddress, token_id: tokenId }} shouldLogImpression > - {!!asset && !!collection && ( - - - - - - - )} + {!!asset && !!collection ? ( + detailsV2Enabled ? ( + + ) : ( + + + + + + + ) + ) : null} )