-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Joaquin Battilana <[email protected]> Co-authored-by: Nikita Boakrev <[email protected]>
- Loading branch information
1 parent
f53c47c
commit 5687dab
Showing
19 changed files
with
1,542 additions
and
173 deletions.
There are no files selected for viewing
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
65 changes: 65 additions & 0 deletions
65
src/components/infoTooltips/WrappedTokenToolTipContent.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,65 @@ | ||
import { ArrowNarrowRightIcon } from '@heroicons/react/solid'; | ||
import { Trans } from '@lingui/macro'; | ||
import { Box, Skeleton, Stack, SvgIcon, Typography } from '@mui/material'; | ||
import { useTokenOutForTokenIn } from 'src/hooks/token-wrapper/useTokenWrapper'; | ||
|
||
import { FormattedNumber } from '../primitives/FormattedNumber'; | ||
|
||
export const WrappedTokenTooltipContent = ({ | ||
decimals, | ||
tokenWrapperAddress, | ||
tokenInSymbol, | ||
tokenOutSymbol, | ||
}: { | ||
decimals: number; | ||
tokenWrapperAddress: string; | ||
tokenInSymbol: string; | ||
tokenOutSymbol: string; | ||
}) => { | ||
const { isLoading: loadingExchangeRate, data: exchangeRate } = useTokenOutForTokenIn( | ||
'1', | ||
decimals, | ||
tokenWrapperAddress | ||
); | ||
|
||
return ( | ||
<Stack direction="column" gap={3}> | ||
<Typography variant="tooltip"> | ||
<Trans> | ||
DAI balance will be converted via DSR contracts and then supplied as sDAI. Switching | ||
incurs no additional costs and no slippage. | ||
</Trans> | ||
</Typography> | ||
<Stack direction="row" alignItems="center" justifyContent="space-between"> | ||
<Box> | ||
<Typography variant="secondary12"> | ||
<Trans>Exchange rate</Trans> | ||
</Typography> | ||
</Box> | ||
{loadingExchangeRate ? ( | ||
<Skeleton variant="rectangular" width={120} height={14} /> | ||
) : ( | ||
<Stack direction="row" alignItems="center" gap={1}> | ||
<FormattedNumber | ||
value="1" | ||
visibleDecimals={0} | ||
variant="secondary12" | ||
color="text.primary" | ||
/> | ||
<Typography variant="tooltip">{tokenInSymbol}</Typography> | ||
<SvgIcon color="primary" sx={{ fontSize: '12px' }}> | ||
<ArrowNarrowRightIcon /> | ||
</SvgIcon> | ||
<FormattedNumber | ||
value={exchangeRate || '0'} | ||
visibleDecimals={4} | ||
variant="secondary12" | ||
color="text.primary" | ||
/> | ||
<Typography variant="tooltip">{tokenOutSymbol}</Typography> | ||
</Stack> | ||
)} | ||
</Stack> | ||
</Stack> | ||
); | ||
}; |
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
Oops, something went wrong.
5687dab
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 commit was deployed on ipfs
5687dab
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 commit was deployed on ipfs