diff --git a/src/components/Create/components/pages/NftRewards/NftAdvancedFormItems.tsx b/src/components/NftRewards/AddNftCollectionForm/NftAdvancedFormItems.tsx
similarity index 100%
rename from src/components/Create/components/pages/NftRewards/NftAdvancedFormItems.tsx
rename to src/components/NftRewards/AddNftCollectionForm/NftAdvancedFormItems.tsx
diff --git a/src/components/Create/components/pages/NftRewards/NftPaymentSuccessFormItems.tsx b/src/components/NftRewards/AddNftCollectionForm/NftPaymentSuccessFormItems.tsx
similarity index 100%
rename from src/components/Create/components/pages/NftRewards/NftPaymentSuccessFormItems.tsx
rename to src/components/NftRewards/AddNftCollectionForm/NftPaymentSuccessFormItems.tsx
diff --git a/src/components/NftRewards/AddNftCollectionForm/index.ts b/src/components/NftRewards/AddNftCollectionForm/index.ts
new file mode 100644
index 0000000000..b915789057
--- /dev/null
+++ b/src/components/NftRewards/AddNftCollectionForm/index.ts
@@ -0,0 +1 @@
+export * from './AddNftCollectionForm'
diff --git a/src/components/Create/components/RewardImage/RewardImage.tsx b/src/components/NftRewards/RewardImage/RewardImage.tsx
similarity index 100%
rename from src/components/Create/components/RewardImage/RewardImage.tsx
rename to src/components/NftRewards/RewardImage/RewardImage.tsx
diff --git a/src/components/Create/components/RewardImage/index.ts b/src/components/NftRewards/RewardImage/index.ts
similarity index 100%
rename from src/components/Create/components/RewardImage/index.ts
rename to src/components/NftRewards/RewardImage/index.ts
diff --git a/src/components/Create/components/RewardsList/AddEditRewardModal.tsx b/src/components/NftRewards/RewardsList/AddEditRewardModal.tsx
similarity index 98%
rename from src/components/Create/components/RewardsList/AddEditRewardModal.tsx
rename to src/components/NftRewards/RewardsList/AddEditRewardModal.tsx
index 743dd0b64b..008cae951b 100644
--- a/src/components/Create/components/RewardsList/AddEditRewardModal.tsx
+++ b/src/components/NftRewards/RewardsList/AddEditRewardModal.tsx
@@ -26,8 +26,8 @@ import {
} from 'utils/antdRules'
import { withHttps } from 'utils/externalLink'
import { ipfsGatewayUrl } from 'utils/ipfs'
-import { CreateCollapse } from '../CreateCollapse'
-import { OptionalHeader } from '../OptionalHeader'
+import { CreateCollapse } from '../../Create/components/CreateCollapse'
+import { OptionalHeader } from '../../Create/components/OptionalHeader'
interface AddEditRewardModalFormProps {
fileUrl: string
diff --git a/src/components/Create/components/RewardsList/RewardItem.tsx b/src/components/NftRewards/RewardsList/RewardItem.tsx
similarity index 100%
rename from src/components/Create/components/RewardsList/RewardItem.tsx
rename to src/components/NftRewards/RewardsList/RewardItem.tsx
diff --git a/src/components/Create/components/RewardsList/RewardItemButton.tsx b/src/components/NftRewards/RewardsList/RewardItemButton.tsx
similarity index 100%
rename from src/components/Create/components/RewardsList/RewardItemButton.tsx
rename to src/components/NftRewards/RewardsList/RewardItemButton.tsx
diff --git a/src/components/Create/components/RewardsList/RewardsList.tsx b/src/components/NftRewards/RewardsList/RewardsList.tsx
similarity index 100%
rename from src/components/Create/components/RewardsList/RewardsList.tsx
rename to src/components/NftRewards/RewardsList/RewardsList.tsx
diff --git a/src/components/Create/components/RewardsList/hooks/index.ts b/src/components/NftRewards/RewardsList/hooks/index.ts
similarity index 100%
rename from src/components/Create/components/RewardsList/hooks/index.ts
rename to src/components/NftRewards/RewardsList/hooks/index.ts
diff --git a/src/components/Create/components/RewardsList/hooks/useRewards.ts b/src/components/NftRewards/RewardsList/hooks/useRewards.ts
similarity index 100%
rename from src/components/Create/components/RewardsList/hooks/useRewards.ts
rename to src/components/NftRewards/RewardsList/hooks/useRewards.ts
diff --git a/src/components/Create/components/RewardsList/index.ts b/src/components/NftRewards/RewardsList/index.ts
similarity index 100%
rename from src/components/Create/components/RewardsList/index.ts
rename to src/components/NftRewards/RewardsList/index.ts
diff --git a/src/components/inputs/UploadNoStyle.tsx b/src/components/inputs/UploadNoStyle.tsx
index 4e60618bb4..c4f45019cb 100644
--- a/src/components/inputs/UploadNoStyle.tsx
+++ b/src/components/inputs/UploadNoStyle.tsx
@@ -2,9 +2,9 @@ import { CloseCircleFilled, UploadOutlined } from '@ant-design/icons'
import { Trans, t } from '@lingui/macro'
import { Progress, Upload, UploadProps } from 'antd'
import { RcFile } from 'antd/lib/upload'
-import { RewardImage } from 'components/Create/components/RewardImage'
import { JuiceVideoPreview } from 'components/JuiceVideo/JuiceVideoPreview'
import Loading from 'components/Loading'
+import { RewardImage } from 'components/NftRewards/RewardImage'
import { CreateButton } from 'components/buttons/CreateButton'
import { useContentType } from 'hooks/useContentType'
import { FormItemInput } from 'models/formItemInput'
diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/hooks/useUpdateCurrentCollection.ts b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/hooks/useUpdateCurrentCollection.ts
index 42c2bba8ea..97bc941949 100644
--- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/hooks/useUpdateCurrentCollection.ts
+++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/hooks/useUpdateCurrentCollection.ts
@@ -1,5 +1,5 @@
import { t } from '@lingui/macro'
-import { NEW_NFT_ID_LOWER_LIMIT } from 'components/Create/components/RewardsList/AddEditRewardModal'
+import { NEW_NFT_ID_LOWER_LIMIT } from 'components/NftRewards/RewardsList/AddEditRewardModal'
import { JB721DelegateContractsContext } from 'contexts/NftRewards/JB721DelegateContracts/JB721DelegateContractsContext'
import { useAdjustTiersTx } from 'hooks/JB721Delegate/transactor/useAdjustTiersTx'
import { NftRewardTier } from 'models/nftRewards'
diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/LaunchNftsCollection.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/LaunchNftsCollection.tsx
index ca5c19c30e..cfcf1b9fee 100644
--- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/LaunchNftsCollection.tsx
+++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/LaunchNftsCollection.tsx
@@ -1,10 +1,49 @@
-import { AddNftCollectionForm } from 'components/Create/components'
+import { Trans } from '@lingui/macro'
+import { AddNftCollectionForm } from 'components/NftRewards/AddNftCollectionForm'
+import TransactionModal from 'components/modals/TransactionModal'
+import { TransactionSuccessModal } from '../../../TransactionSuccessModal'
import { UploadAndLaunchNftsButton } from './UploadAndLaunchNftsButton'
+import { useSettingsLaunchNftsForm } from './hooks/useSettingsLaunchNftsForm'
export function LaunchNftsPage() {
+ const {
+ form,
+ launchCollection,
+ launchButtonLoading,
+ launchTxPending,
+ successModalOpen,
+ setSuccessModalOpen,
+ } = useSettingsLaunchNftsForm()
return (
-
}
- />
+ <>
+
launchCollection}
+ loading={launchButtonLoading}
+ />
+ }
+ />
+
+ setSuccessModalOpen(false)}
+ content={
+ <>
+
+ Your new NFTs have been deployed
+
+
+
+ New NFTs will be available in your next cycle as long as it
+ starts after your edit deadline.
+
+
+ >
+ }
+ />
+ >
)
}
diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/UploadAndLaunchNftsButton.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/UploadAndLaunchNftsButton.tsx
index deefc155f7..059d9c32b1 100644
--- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/UploadAndLaunchNftsButton.tsx
+++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/UploadAndLaunchNftsButton.tsx
@@ -1,121 +1,23 @@
import { Trans } from '@lingui/macro'
import { Button } from 'antd'
-import TransactionModal from 'components/modals/TransactionModal'
-import { useState } from 'react'
-import { useAppSelector } from 'redux/hooks/useAppSelector'
-import { pinNftCollectionMetadata, pinNftRewards } from 'utils/nftRewards'
-import { TransactionSuccessModal } from '../../../TransactionSuccessModal'
-import {
- EditingFundingCycleConfig,
- useEditingFundingCycleConfig,
-} from '../../ReconfigureFundingCycleSettingsPage/hooks/useEditingFundingCycleConfig'
-import { useReconfigureFundingCycle } from '../../ReconfigureFundingCycleSettingsPage/hooks/useReconfigureFundingCycle'
export function UploadAndLaunchNftsButton({
className,
+ onClick,
+ loading,
}: {
className?: string
+ onClick?: VoidFunction
+ loading: boolean
}) {
- const [ipfsUploading, setIpfsUploading] = useState(false)
- const [successModalOpen, setSuccessModalOpen] = useState(false)
-
- const {
- projectMetadata: { logoUri },
- } = useAppSelector(state => state.editingV2Project)
-
- const editingFundingCycleConfig = useEditingFundingCycleConfig()
- const { reconfigureLoading, reconfigureFundingCycle, txPending } =
- useReconfigureFundingCycle({
- editingFundingCycleConfig,
- memo: 'First NFT collection',
- launchedNewNfts: true,
- onComplete: () => setSuccessModalOpen(true),
- })
-
- const buttonLoading = ipfsUploading || reconfigureLoading
-
- const {
- editingPayoutGroupedSplits,
- editingReservedTokensGroupedSplits,
- editingFundingCycleMetadata,
- editingFundingCycleData,
- editingFundAccessConstraints,
- editingNftRewards,
- editingMustStartAtOrAfter,
- } = editingFundingCycleConfig
-
- const uploadNftsToIpfs = async () => {
- setIpfsUploading(true)
- const newRewardTiers =
- editingFundingCycleConfig.editingNftRewards?.rewardTiers
- const collectionName =
- editingFundingCycleConfig.editingNftRewards?.collectionMetadata.name ?? ''
- const collectionDescription =
- editingFundingCycleConfig.editingNftRewards?.collectionMetadata
- .description ?? ''
- const collectionLogoUri = logoUri ?? ''
- const collectionInfoUri =
- editingFundingCycleConfig.editingNftRewards?.collectionMetadata.uri ?? ''
-
- const [rewardTiersCIDs, nftCollectionMetadataUri] = await Promise.all([
- newRewardTiers ? pinNftRewards(newRewardTiers) : [],
- pinNftCollectionMetadata({
- collectionName,
- collectionDescription,
- collectionLogoUri,
- collectionInfoUri,
- }),
- ])
- const latestEditingData: EditingFundingCycleConfig = {
- editingPayoutGroupedSplits,
- editingReservedTokensGroupedSplits,
- editingFundingCycleMetadata,
- editingFundingCycleData,
- editingFundAccessConstraints,
- editingNftRewards: editingNftRewards
- ? {
- ...editingNftRewards,
- collectionMetadata: {
- ...editingNftRewards.collectionMetadata,
- uri: nftCollectionMetadataUri,
- },
- CIDs: rewardTiersCIDs,
- }
- : undefined,
- editingMustStartAtOrAfter,
- }
- reconfigureFundingCycle(latestEditingData)
- setIpfsUploading(false)
- }
-
return (
- <>
-
-
- setSuccessModalOpen(false)}
- content={
- <>
-
- Your new NFTs have been deployed
-
-
-
- New NFTs will be available in your next cycle as long as it
- starts after your edit deadline.
-
-
- >
- }
- />
- >
+
)
}
diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/hooks/useSettingsLaunchNftsForm.ts b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/hooks/useSettingsLaunchNftsForm.ts
new file mode 100644
index 0000000000..f707a398c9
--- /dev/null
+++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftCollection/hooks/useSettingsLaunchNftsForm.ts
@@ -0,0 +1,117 @@
+import { useForm } from 'antd/lib/form/Form'
+import { NftRewardsFormProps } from 'components/NftRewards/AddNftCollectionForm'
+import { JB721GovernanceType } from 'models/nftRewards'
+import { useState } from 'react'
+import { useAppSelector } from 'redux/hooks/useAppSelector'
+import { DEFAULT_NFT_FLAGS } from 'redux/slices/editingV2Project'
+import {
+ defaultNftCollectionDescription,
+ defaultNftCollectionName,
+ pinNftCollectionMetadata,
+ pinNftRewards,
+} from 'utils/nftRewards'
+import {
+ EditingFundingCycleConfig,
+ useEditingFundingCycleConfig,
+} from '../../../ReconfigureFundingCycleSettingsPage/hooks/useEditingFundingCycleConfig'
+import { useReconfigureFundingCycle } from '../../../ReconfigureFundingCycleSettingsPage/hooks/useReconfigureFundingCycle'
+
+export const useSettingsLaunchNftsForm = () => {
+ const [form] = useForm()
+
+ const [ipfsUploading, setIpfsUploading] = useState(false)
+ const [successModalOpen, setSuccessModalOpen] = useState(false)
+
+ const {
+ projectMetadata: { logoUri, name: projectName },
+ } = useAppSelector(state => state.editingV2Project)
+
+ const editingFundingCycleConfig = useEditingFundingCycleConfig()
+ const {
+ reconfigureLoading,
+ reconfigureFundingCycle,
+ txPending: launchTxPending,
+ } = useReconfigureFundingCycle({
+ editingFundingCycleConfig,
+ memo: 'First NFT collection',
+ launchedNewNfts: true,
+ onComplete: () => setSuccessModalOpen(true),
+ })
+
+ const launchButtonLoading = ipfsUploading || reconfigureLoading
+
+ const {
+ editingPayoutGroupedSplits,
+ editingReservedTokensGroupedSplits,
+ editingFundingCycleMetadata,
+ editingFundingCycleData,
+ editingFundAccessConstraints,
+ editingMustStartAtOrAfter,
+ } = editingFundingCycleConfig
+
+ const launchCollection = async () => {
+ setIpfsUploading(true)
+ const formValues = form.getFieldsValue(true) as NftRewardsFormProps
+ const newRewardTiers = formValues.rewards
+ const collectionName =
+ formValues.collectionName ?? defaultNftCollectionName(projectName)
+ const collectionDescription =
+ formValues.collectionDescription ??
+ defaultNftCollectionDescription(projectName)
+ const collectionLogoUri = logoUri ?? ''
+ const collectionInfoUri = ''
+
+ const [rewardTiersCIDs, nftCollectionMetadataUri] = await Promise.all([
+ newRewardTiers ? pinNftRewards(newRewardTiers) : [],
+ pinNftCollectionMetadata({
+ collectionName,
+ collectionDescription,
+ collectionLogoUri,
+ collectionInfoUri,
+ }),
+ ])
+
+ const latestEditingData: EditingFundingCycleConfig = {
+ editingPayoutGroupedSplits,
+ editingReservedTokensGroupedSplits,
+ editingFundingCycleMetadata,
+ editingFundingCycleData,
+ editingFundAccessConstraints,
+ editingNftRewards: {
+ rewardTiers: newRewardTiers,
+ collectionMetadata: {
+ uri: nftCollectionMetadataUri,
+ symbol: formValues.collectionSymbol,
+ name: collectionName,
+ description: collectionDescription,
+ },
+ CIDs: rewardTiersCIDs,
+ postPayModal: {
+ ctaText: formValues.postPayButtonText,
+ ctaLink: formValues.postPayButtonLink,
+ content: formValues.postPayMessage,
+ },
+ flags: {
+ ...DEFAULT_NFT_FLAGS,
+ preventOverspending:
+ formValues.preventOverspending ??
+ DEFAULT_NFT_FLAGS.preventOverspending,
+ },
+ governanceType:
+ formValues.onChainGovernance ?? JB721GovernanceType.NONE,
+ },
+ editingMustStartAtOrAfter,
+ }
+ reconfigureFundingCycle(latestEditingData)
+ setIpfsUploading(false)
+ }
+
+ return {
+ form,
+ launchButtonLoading,
+ launchCollection,
+ successModalOpen,
+ setSuccessModalOpen,
+ launchTxPending,
+ }
+}
diff --git a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsPostPaySection/EditNftsPostPaySection.tsx b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsPostPaySection/EditNftsPostPaySection.tsx
index 0e89354040..db60de9fd8 100644
--- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsPostPaySection/EditNftsPostPaySection.tsx
+++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsPostPaySection/EditNftsPostPaySection.tsx
@@ -1,6 +1,6 @@
import { Trans } from '@lingui/macro'
import { Button, Form } from 'antd'
-import { NftPaymentSuccessFormItems } from 'components/Create/components/pages/NftRewards/NftPaymentSuccessFormItems'
+import { NftPaymentSuccessFormItems } from 'components/NftRewards/AddNftCollectionForm/NftPaymentSuccessFormItems'
import { PV_V2 } from 'constants/pv'
import { ProjectMetadataContext } from 'contexts/shared/ProjectMetadataContext'
import { useEditProjectDetailsTx } from 'hooks/v2v3/transactor/useEditProjectDetailsTx'
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 200aa44f15..d19edaa178 100644
--- a/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsSection.tsx
+++ b/src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/UpdateNftsPage/EditNftsSection.tsx
@@ -1,8 +1,8 @@
import { t, Trans } from '@lingui/macro'
import { Button, Empty } from 'antd'
import { Callout } from 'components/Callout'
-import { RewardsList } from 'components/Create/components/RewardsList'
import Loading from 'components/Loading'
+import { RewardsList } from 'components/NftRewards/RewardsList'
import { useUpdateCurrentCollection } from 'components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/hooks/useUpdateCurrentCollection'
import { useHasNftRewards } from 'hooks/JB721Delegate/useHasNftRewards'
diff --git a/src/components/v2v3/shared/FundingCycleConfigurationDrawers/NftDrawer/AddNftsSection/AddNftsSection.tsx b/src/components/v2v3/shared/FundingCycleConfigurationDrawers/NftDrawer/AddNftsSection/AddNftsSection.tsx
index f5bdc5f746..67ea0e08f9 100644
--- a/src/components/v2v3/shared/FundingCycleConfigurationDrawers/NftDrawer/AddNftsSection/AddNftsSection.tsx
+++ b/src/components/v2v3/shared/FundingCycleConfigurationDrawers/NftDrawer/AddNftsSection/AddNftsSection.tsx
@@ -1,6 +1,6 @@
import { t, Trans } from '@lingui/macro'
import { Button, Empty, Form } from 'antd'
-import { RewardsList } from 'components/Create/components/RewardsList'
+import { RewardsList } from 'components/NftRewards/RewardsList'
import { useCallback, useState } from 'react'
import { emitErrorNotification } from 'utils/notifications'