Skip to content

Commit

Permalink
feat: remove onchain gov from nfts
Browse files Browse the repository at this point in the history
  • Loading branch information
aeolianeth committed May 26, 2024
1 parent 9be04bd commit 8901b28
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 167 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Form } from 'antd'
import { NftRewardsFormProps } from 'components/NftRewards/AddNftCollectionForm/AddNftCollectionForm'
import { JB721GovernanceType, NftRewardTier } from 'models/nftRewards'
import { NftRewardTier } from 'models/nftRewards'
import { useEffect, useMemo } from 'react'
import { useAppDispatch } from 'redux/hooks/useAppDispatch'
import { useAppSelector } from 'redux/hooks/useAppSelector'
Expand Down Expand Up @@ -136,23 +136,6 @@ export const useCreateFlowNftRewardsForm = () => {
},
})

useFormDispatchWatch({
form,
fieldName: 'onChainGovernance',
ignoreUndefined: true,
dispatchFunction: editingV2ProjectActions.setNftRewardsGovernance,
formatter: v => {
if (
!v ||
typeof v === 'string' ||
typeof v === 'object' ||
typeof v === 'boolean'
)
return JB721GovernanceType.NONE
return v
},
})

useFormDispatchWatch({
form,
fieldName: 'useDataSourceForRedeem',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { t } from '@lingui/macro'
import { RewardsList } from 'components/NftRewards/RewardsList/RewardsList'
import { JB721GovernanceType, NftRewardTier } from 'models/nftRewards'
import { NftRewardTier } from 'models/nftRewards'
import { useCallback, useMemo } from 'react'
import { useAppDispatch } from 'redux/hooks/useAppDispatch'
import { useAppSelector } from 'redux/hooks/useAppSelector'
Expand All @@ -11,7 +11,7 @@ import { ReviewDescription } from '../ReviewDescription'

export const RewardsReview = () => {
const {
nftRewards: { rewardTiers, flags, governanceType },
nftRewards: { rewardTiers, flags },
fundingCycleMetadata,
} = useAppSelector(state => state.editingV2Project)

Expand Down Expand Up @@ -66,16 +66,6 @@ export const RewardsReview = () => {
return formatEnabled(flags.preventOverspending)
}, [flags.preventOverspending])

const onChainGovernance = useMemo(() => {
switch (governanceType) {
case JB721GovernanceType.ONCHAIN:
return t`Standard`
case JB721GovernanceType.NONE:
default:
return t`None`
}
}, [governanceType])

return (
<div className="flex flex-col gap-12">
<RewardsList value={rewards} onChange={setRewards} />
Expand All @@ -88,12 +78,6 @@ export const RewardsReview = () => {
</div>
}
/>
<ReviewDescription
title={t`On-chain governance type`}
desc={
<div className="text-base font-medium">{onChainGovernance}</div>
}
/>
<ReviewDescription
title={t`Prevent NFT overspending`}
desc={
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { RightOutlined } from '@ant-design/icons'
import { Trans, t } from '@lingui/macro'
import { Form, FormInstance, Radio } from 'antd'
import { Form, FormInstance } from 'antd'
import { useLockPageRulesWrapper } from 'components/Create/hooks/useLockPageRulesWrapper'
import ExternalLink from 'components/ExternalLink'
import TooltipLabel from 'components/TooltipLabel'
import { JuiceInput } from 'components/inputs/JuiceTextInput'
import { RadioItem } from 'components/inputs/RadioItem'
import { JB721GovernanceType, NftRewardTier } from 'models/nftRewards'
import { NftRewardTier } from 'models/nftRewards'
import { inputMustExistRule } from 'utils/antdRules'
import { helpPagePath } from 'utils/routes'
import { CreateBadge } from '../../Create/components/CreateBadge'
import { CreateCollapse } from '../../Create/components/CreateCollapse/CreateCollapse'
import { OptionalHeader } from '../../Create/components/OptionalHeader'
import { RewardsList } from '../RewardsList/RewardsList'
Expand All @@ -24,7 +21,6 @@ export type NftRewardsFormProps = Partial<{
postPayMessage?: string
postPayButtonText?: string
postPayButtonLink?: string
onChainGovernance: JB721GovernanceType
useDataSourceForRedeem: boolean
preventOverspending: boolean
}>
Expand Down Expand Up @@ -121,43 +117,6 @@ export const AddNftCollectionForm = ({
</Form.Item>

<CreateCollapse>
<CreateCollapse.Panel
key={1}
header={<OptionalHeader header={t`On-chain Governance`} />}
hideDivider
>
<Form.Item name="onChainGovernance">
<Radio.Group className="flex flex-col gap-5">
<RadioItem
value={JB721GovernanceType.NONE}
title={
<div className="flex items-center gap-3">
<Trans>No on-chain governance</Trans>{' '}
<CreateBadge.Default />
</div>
}
description={t`Your project's NFTs will not have on-chain governance capabilities. Select this option if you don't want governance, or if you plan to use an off-chain voting client (like Snapshot).`}
/>
<RadioItem
value={JB721GovernanceType.ONCHAIN}
title={t`Standard on-chain governance`}
description={
<Trans>
Track the total voting power of each address over
time.{' '}
<ExternalLink
href={helpPagePath(
'/user/configuration/#on-chain-governance',
)}
>
Learn more.
</ExternalLink>
</Trans>
}
/>
</Radio.Group>
</Form.Item>
</CreateCollapse.Panel>
<CreateCollapse.Panel
key={2}
header={<OptionalHeader header={t`Payment Success Pop-up`} />}
Expand Down
20 changes: 0 additions & 20 deletions src/components/NftRewards/RewardsList/AddEditRewardModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,26 +337,6 @@ export const AddEditRewardModal = ({
</Form.Item>
</>
)}
<Form.Item
name="votingWeight"
label={t`Voting weight`}
extra={t`Give this NFT a voting weight to be used for on-chain governance. The number you set is only used in relation to other NFTs in this collection.`}
tooltip={
<Trans>
If you use the default governance option (no governance), the
voting weight will still be accessible on the blockchain for
use in Snapshot strategies or any other desired purpose.
</Trans>
}
rules={[
inputIsIntegerRule({
label: t`Voting weight`,
stringOkay: true,
}),
]}
>
<FormattedNumberInput />
</Form.Item>
<Form.Item
name="externalUrl"
label={t`External link`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ export const useLaunchNftsForm = () => {
formValues.preventOverspending ??
DEFAULT_NFT_FLAGS.preventOverspending,
},
governanceType:
formValues.onChainGovernance ?? JB721GovernanceType.NONE,
governanceType: JB721GovernanceType.NONE,
pricing: DEFAULT_NFT_PRICING, // TODO add to form
},
editingMustStartAtOrAfter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,11 @@ export function EditCollectionDetailsSection() {
'collectionSymbol',
initialValues.collectionSymbol,
)
const onchainGovernanceChanged = hasChanged(
'onChainGovernance',
initialValues.onChainGovernance,
)

const hasUpdated =
collectionNameChanged ||
collectionDescriptionChanged ||
collectionSymbolChanged ||
onchainGovernanceChanged
collectionSymbolChanged

setFormHasUpdated(hasUpdated)
}, [marketplaceForm, initialValues, setFormHasUpdated])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { JB721GovernanceType } from 'models/nftRewards'

export type MarketplaceFormFields = {
collectionName: string
collectionSymbol: string
collectionDescription: string
onChainGovernance: JB721GovernanceType
}
Loading

0 comments on commit 8901b28

Please sign in to comment.