Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyd-eth committed Sep 9, 2023
1 parent 0394291 commit 08bd3c7
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <Loading />
}
if (hasExistingNfts) {
return <UpdateNftsPage />
} else if (!nftDeployerCanReconfigure) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ export function EditNftsSection() {
setSubmitLoading(false)
}, [rewardTiers, updateExistingCollection])

if (loading) return <Loading />
// 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 <Loading className="mt-20" />

return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './UpdateNftsTabs'
export * from './UpdateNftsPage'

0 comments on commit 08bd3c7

Please sign in to comment.