diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/ProjectSettingsContent.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/ProjectSettingsContent.tsx index ce77578c91..fd98432b22 100644 --- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/ProjectSettingsContent.tsx +++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/ProjectSettingsContent.tsx @@ -1,12 +1,13 @@ +import * as constants from '@ethersproject/constants' import { ChevronRightIcon } from '@heroicons/react/20/solid' import { ArrowLeftIcon } from '@heroicons/react/24/outline' import { Trans, t } from '@lingui/macro' import { Button, Layout } from 'antd' import { V2V3SettingsPageKey } from 'components/v2v3/V2V3Project/V2V3ProjectSettings/ProjectSettingsDashboard' import { FEATURE_FLAGS } from 'constants/featureFlags' -import { useHasNftRewards } from 'hooks/JB721Delegate/useHasNftRewards' +import { V2V3ProjectContext } from 'contexts/v2v3/Project/V2V3ProjectContext' import Link from 'next/link' -import { useMemo } from 'react' +import { useContext, useMemo } from 'react' import { twJoin } from 'tailwind-merge' import { featureFlagEnabled } from 'utils/featureFlags' import { ProjectSettingsLayout } from './ProjectSettingsLayout' @@ -105,7 +106,9 @@ export function ProjectSettingsContent({ }: { settingsPageKey: V2V3SettingsPageKey }) { - const { value: hasExistingNfts } = useHasNftRewards() + const { fundingCycleMetadata } = useContext(V2V3ProjectContext) + const hasExistingNfts = + fundingCycleMetadata?.dataSource !== constants.AddressZero const ActiveSettingsPage = useMemo( () => SettingsPageComponents[settingsPageKey], diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/EditNftsPage.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/EditNftsPage.tsx index dbe37a62f4..095b962219 100644 --- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/EditNftsPage.tsx +++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/EditNftsPage.tsx @@ -8,7 +8,7 @@ import Image from 'next/image' import Link from 'next/link' import { useContext } from 'react' import { settingsPagePath } from 'utils/routes' -import { UpdateNftsPage } from '../NewEditNftsPage/UpdateNftsPage' +import { UpdateNftsPage } from '../NewEditNftsPage/UpdateNftsPage/UpdateNftsPage' import blueberry from '/public/assets/images/blueberry-ol.png' export function EditNftsPage() { diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/EditNftsPage.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/EditNftsPage.tsx index 740c39789a..a5a08d8031 100644 --- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/EditNftsPage.tsx +++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/EditNftsPage.tsx @@ -1,26 +1,24 @@ -import Loading from 'components/Loading' +import * as constants from '@ethersproject/constants' import { ProjectMetadataContext } from 'contexts/shared/ProjectMetadataContext' import { V2V3ProjectContext } from 'contexts/v2v3/Project/V2V3ProjectContext' import { useNftDeployerCanReconfigure } from 'hooks/JB721Delegate/contractReader/useNftDeployerCanReconfigure' -import { useHasNftRewards } from 'hooks/JB721Delegate/useHasNftRewards' import { useContext } from 'react' import { EnableNftsCard } from './LaunchNftCollection/EnableNftsCard' import { LaunchNftsPage } from './LaunchNftCollection/LaunchNftsCollection' -import { UpdateNftsPage } from './UpdateNftsPage' +import { UpdateNftsPage } from './UpdateNftsPage/UpdateNftsPage' export function EditNftsPage() { const { projectId } = useContext(ProjectMetadataContext) - const { projectOwnerAddress } = useContext(V2V3ProjectContext) - const { value: hasExistingNfts, loading: hasNftsLoading } = useHasNftRewards() + const { projectOwnerAddress, fundingCycleMetadata } = + useContext(V2V3ProjectContext) + const hasExistingNfts = + fundingCycleMetadata?.dataSource !== constants.AddressZero const nftDeployerCanReconfigure = useNftDeployerCanReconfigure({ projectId, projectOwnerAddress, }) - if (hasNftsLoading) { - return - } if (hasExistingNfts) { return } else if (!nftDeployerCanReconfigure) { diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsSection.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsSection.tsx index e61124cb5b..200aa44f15 100644 --- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsSection.tsx +++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsSection.tsx @@ -27,7 +27,11 @@ export function EditNftsSection() { setSubmitLoading(false) }, [rewardTiers, updateExistingCollection]) - if (loading) return + // this component only renders when data source is not 0x000.. + // so if there are no rewardTiers here, it's safe to assume they're still loading + const noTiers = !rewardTiers || rewardTiers.length === 0 + + if (loading || noTiers) return return ( <> diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/index.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/index.tsx index 009d19ecd3..511e1182d5 100644 --- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/index.tsx +++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/index.tsx @@ -1 +1 @@ -export * from './UpdateNftsTabs' +export * from './UpdateNftsPage'