Skip to content

Commit

Permalink
add: missing swap value for one-time donation
Browse files Browse the repository at this point in the history
  • Loading branch information
L03TJ3 committed Nov 26, 2024
1 parent 70c2bc8 commit 3395fa7
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions packages/app/src/components/DonateComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ const shouldWarning = (
return { isNonZeroDonation, isInsufficientBalance, isInsufficientLiquidity, isUnacceptablePriceImpact };
};

const SwapValue = ({ swapValue }: { swapValue: number }) => (
<Text textAlign="right" fontSize="sm " color="goodGrey.25">
=
<Text variant="bold" fontWeight="700">
{' '}
G${' '}
</Text>
{swapValue.toFixed(4)}
</Text>
);

const WarningBox = ({ content, explanationProps = {} }: any) => {
const Explanation = content.Explanation;

Expand Down Expand Up @@ -540,6 +551,9 @@ const DonateComponent = ({ collective }: DonateComponentProps) => {
options={currencyOptions}
isWarning={isWarning}
/>
{frequency === 'One-Time' && currency === 'CELO' && isNonZeroDonation && swapValue ? (
<SwapValue {...{ swapValue }} />
) : null}
</VStack>

<VStack space={2} {...(isMobileView ? { maxWidth: '343' } : { minWidth: '343', maxWidth: '10%' })}>
Expand Down Expand Up @@ -591,14 +605,7 @@ const DonateComponent = ({ collective }: DonateComponentProps) => {
<Text variant="bold" color="goodPurple.400" fontSize="2xl" textAlign="right">
CELO {decimalDonationAmount}
</Text>
<Text textAlign="right" fontSize="sm " color="goodGrey.25">
=
<Text variant="bold" fontWeight="700">
{' '}
G${' '}
</Text>
{swapValue.toFixed(4)}
</Text>
<SwapValue {...{ swapValue }} />
</VStack>
</VStack>
) : null}
Expand Down

0 comments on commit 3395fa7

Please sign in to comment.