Skip to content

Commit

Permalink
fix: Ensure reserved token recipients does not show when reserved rat… (
Browse files Browse the repository at this point in the history
  • Loading branch information
wraeth-eth authored Jan 21, 2025
1 parent c223ae8 commit 09cbb89
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
formatRedemptionRate,
formatReservedRate,
} from 'packages/v2v3/utils/math'
import React from 'react'
import { formatAmount } from 'utils/format/formatAmount'
import * as ProjectTokenForm from '../../../ProjectToken/hooks/useProjectTokenForm'
import { ReviewDescription } from '../ReviewDescription'
Expand All @@ -23,6 +24,15 @@ export const ProjectTokenReview = () => {
weight,
} = useProjectTokenReview()

const showReservedTokenRecipients = React.useMemo(() => {
return (
(reservedRate.length > 0
? BigInt(reservedRate)
: BigInt(ProjectTokenForm.DefaultSettings.reservedTokensPercentage)) >
0n
)
}, [reservedRate])

return (
<div className="flex flex-col gap-y-10 pt-5 pb-12 md:grid md:grid-cols-4">
<ReviewDescription
Expand All @@ -49,16 +59,19 @@ export const ProjectTokenReview = () => {
</div>
}
/>
<ReviewDescription
className="col-span-2"
title={t`Reserved token recipients`}
desc={
<ReservedTokensList
value={allocationSplits}
onChange={setAllocationSplits}
/>
}
/>
{showReservedTokenRecipients && (
<ReviewDescription
className="col-span-2"
title={t`Reserved token recipients`}
desc={
<ReservedTokensList
value={allocationSplits}
onChange={setAllocationSplits}
isEditable={false}
/>
}
/>
)}
<ReviewDescription
title={t`Issuance reduction rate`}
desc={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
formatRedemptionRate,
formatReservedRate,
} from 'packages/v2v3/utils/math'
import React from 'react'
import { formatAmount } from 'utils/format/formatAmount'
import * as ProjectTokenForm from '../../../ProjectToken/hooks/useProjectTokenForm'
import { ReviewDescription } from '../ReviewDescription'
Expand All @@ -23,6 +24,15 @@ export const ProjectTokenReview = () => {
weight,
} = useProjectTokenReview()

const showReservedTokenRecipients = React.useMemo(() => {
return (
(reservedRate.length > 0
? BigInt(reservedRate)
: BigInt(ProjectTokenForm.DefaultSettings.reservedTokensPercentage)) >
0n
)
}, [reservedRate])

return (
<div className="flex flex-col gap-y-10 pt-5 pb-12 md:grid md:grid-cols-4">
<ReviewDescription
Expand All @@ -49,16 +59,19 @@ export const ProjectTokenReview = () => {
</div>
}
/>
<ReviewDescription
className="col-span-2"
title={t`Reserved token recipients`}
desc={
<ReservedTokensList
value={allocationSplits}
onChange={setAllocationSplits}
/>
}
/>
{showReservedTokenRecipients && (
<ReviewDescription
className="col-span-2"
title={t`Reserved token recipients`}
desc={
<ReservedTokensList
value={allocationSplits}
onChange={setAllocationSplits}
isEditable={false}
/>
}
/>
)}
<ReviewDescription
title={t`Decay percent`}
desc={
Expand Down

0 comments on commit 09cbb89

Please sign in to comment.