-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Edit NFTs [1/2]: Redo /settings/nfts
to account for all project NFT states
#4051
Merged
Merged
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8cc9ad9
Launch new NFT collection flow
johnnyd-eth 8120af0
[PREVIEW] handle ipfs uploads nft form
johnnyd-eth 5ea31ee
Merge branch 'main' of github.com-johnnyd-eth:jbx-protocol/juice-inte…
johnnyd-eth 7900a13
[PREVIEW] Complete launch NFT collection form
johnnyd-eth edaaf9a
Merge branch 'main' into launch-nfts-from-nfts-page
johnnyd-eth 0394291
Edit NFTs [2/2]: Edit NFTs post-pay modal data (#4056)
johnnyd-eth 08bd3c7
Rebase
johnnyd-eth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export * from './NftRewardsPage' | ||
export * from './AddNftCollectionForm' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/EditNftsTabs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { t } from '@lingui/macro' | ||
import { Tabs } from 'antd' | ||
import { EditCollectionDetailsSection } from './EditCollectionDetailsSection' | ||
import { EditNftsSection } from './EditNftsSection' | ||
|
||
export function EditNftsTabs() { | ||
const items = [ | ||
{ label: t`NFTs`, key: 'nfts', children: <EditNftsSection /> }, | ||
{ | ||
label: t`Collection details`, | ||
key: 'collection', | ||
children: <EditCollectionDetailsSection />, | ||
}, | ||
// TODO: add advanced tab | ||
] | ||
|
||
return <Tabs items={items} /> | ||
} |
38 changes: 0 additions & 38 deletions
38
src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/EnableNftsCard.tsx
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
...components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/NewEditNftsSection.tsx
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/EditNftsPage/NftsTable.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/EditNftsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Loading from 'components/Loading' | ||
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 { EditNftsTabs } from '../EditNftsPage/EditNftsTabs' | ||
import { EnableNftsCard } from './EnableNftsCard' | ||
import { LaunchNftsPage } from './LaunchNftsPage' | ||
|
||
export function EditNftsPage() { | ||
const { projectId } = useContext(ProjectMetadataContext) | ||
const { projectOwnerAddress } = useContext(V2V3ProjectContext) | ||
const { value: hasExistingNfts, loading: hasNftsLoading } = useHasNftRewards() | ||
|
||
const nftDeployerCanReconfigure = useNftDeployerCanReconfigure({ | ||
projectId, | ||
projectOwnerAddress, | ||
}) | ||
|
||
if (hasNftsLoading) { | ||
return <Loading /> | ||
} | ||
if (hasExistingNfts) { | ||
return <EditNftsTabs /> | ||
} else if (!nftDeployerCanReconfigure) { | ||
return <EnableNftsCard /> | ||
} else { | ||
return <LaunchNftsPage /> | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/EnableNftsCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Trans } from '@lingui/macro' | ||
import { Button } from 'antd' | ||
import Image from 'next/image' | ||
import { useState } from 'react' | ||
import { EnableNftsModal } from './EnableNftsModal' | ||
import noNftsImage from '/public/assets/images/settings/no-nfts.webp' | ||
|
||
export function EnableNftsCard() { | ||
const [enableNftsModalOpen, setEnableNftsModalOpen] = useState<boolean>(false) | ||
return ( | ||
<> | ||
<div className="flex flex-col items-center gap-5"> | ||
<Image | ||
src={noNftsImage} | ||
alt={`No NFT collection`} | ||
width={200} | ||
height={200} | ||
style={{ | ||
maxWidth: '100%', | ||
height: 'auto', | ||
}} | ||
/> | ||
<span className="text-secondary"> | ||
<Trans>You haven't launched an NFT collection yet.</Trans> | ||
</span> | ||
<Button type="primary" onClick={() => setEnableNftsModalOpen(true)}> | ||
<span> | ||
<Trans>Enable NFTs</Trans> | ||
</span> | ||
</Button> | ||
</div> | ||
|
||
<EnableNftsModal | ||
open={enableNftsModalOpen} | ||
onClose={() => setEnableNftsModalOpen(false)} | ||
/> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import TooltipIcon from 'components/TooltipIcon' | |
import TransactionModal from 'components/modals/TransactionModal' | ||
import { useSetNftOperatorPermissionsTx } from 'hooks/JB721Delegate/transactor/useSetNftOperatorPermissionsTx' | ||
import { useState } from 'react' | ||
import { reloadWindow } from 'utils/windowUtils' | ||
|
||
export function EnableNftsModal({ | ||
open, | ||
|
@@ -21,7 +22,7 @@ export function EnableNftsModal({ | |
await setNftOperatorPermissionsTx(undefined, { | ||
onConfirmed: () => { | ||
setLoading(false) | ||
onClose() | ||
reloadWindow() | ||
}, | ||
onDone() { | ||
setLoading(false) | ||
|
@@ -43,8 +44,8 @@ export function EnableNftsModal({ | |
confirmLoading={loading} | ||
> | ||
<Trans> | ||
To add NFTs to your cycle. You'll need to{' '} | ||
<strong>grant NFT permissions</strong> before launching your new cycle. | ||
To add NFTs to your next cycle, you'll need to{' '} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. praise nice catch |
||
<strong>grant NFT permissions</strong>. | ||
</Trans>{' '} | ||
<TooltipIcon | ||
tip={ | ||
|
10 changes: 10 additions & 0 deletions
10
src/components/v2v3/V2V3Project/V2V3ProjectSettings/pages/NewEditNftsPage/LaunchNftsPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { AddNftCollectionForm } from 'components/Create/components' | ||
import { UploadAndLaunchNftsButton } from './UploadAndLaunchNftsButton' | ||
|
||
export function LaunchNftsPage() { | ||
return ( | ||
<AddNftCollectionForm | ||
okButton={<UploadAndLaunchNftsButton className="mt-10" />} | ||
/> | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This button enables operator permissions (allow NFT contract reconfig FC)