Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/Card/Card.theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ export const CardStyle = {
container: {
bg: 'background.surface.raised.base',
borderColor: 'border.base',
_dark: {
boxShadow: '0 1px 0 var(--chakra-colors-border-base) inset, var(--chakra-shadows-sm)',
},
},
}),
unstyled: {
Expand Down
13 changes: 4 additions & 9 deletions src/pages/Yields/components/YieldAvailableToDeposit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,12 @@ export const YieldAvailableToDeposit = memo(
}

return (
<Card variant='dashboard'>
<Card>
<CardBody p={{ base: 4, md: 5 }}>
<VStack spacing={4} align='stretch'>
<Flex justifyContent='space-between' alignItems='center'>
<HStack spacing={2}>
<Heading
as='h3'
size='sm'
textTransform='uppercase'
color='text.subtle'
letterSpacing='wider'
>
<Heading as='h3' size='sm' color='text.subtle'>
{translate('yieldXYZ.availableToDeposit')}
</Heading>
<Tooltip label={tooltipLabel} placement='top'>
Expand Down Expand Up @@ -182,8 +176,9 @@ export const YieldAvailableToDeposit = memo(
<Amount.Fiat
fontSize='sm'
fontWeight='semibold'
color='text.success'
value={potentialYearlyEarningsFiat.toFixed()}
suffix='/yr'
suffix={translate('yieldXYZ.perYear')}
/>
</Flex>
)}
Expand Down
120 changes: 28 additions & 92 deletions src/pages/Yields/components/YieldInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import {
AlertDescription,
AlertIcon,
Avatar,
Badge,
Box,
Card,
CardBody,
Flex,
Heading,
HStack,
Tag,
Text,
VStack,
} from '@chakra-ui/react'
Expand Down Expand Up @@ -53,41 +53,8 @@ export const YieldInfoCard = memo(
<AssetIcon src={iconSource.src} size='lg' />
)

const hasOverlay = validatorOrProvider?.logoURI || yieldItem.chainId

const stackedIconElement = !hasOverlay ? (
assetIcon
) : (
<Box position='relative'>
{assetIcon}
{validatorOrProvider?.logoURI ? (
<Avatar
size='xs'
src={validatorOrProvider.logoURI}
name={validatorOrProvider.name}
position='absolute'
bottom='-4px'
right='-4px'
border='2px solid'
borderColor='background.surface.raised.base'
/>
) : yieldItem.chainId ? (
<Box
position='absolute'
bottom='-4px'
right='-4px'
bg='background.surface.raised.base'
borderRadius='full'
p='3px'
>
<ChainIcon chainId={yieldItem.chainId} boxSize='16px' />
</Box>
) : null}
</Box>
)

return (
<Card variant='dashboard'>
<Card>
<CardBody p={{ base: 4, md: 6 }}>
<VStack spacing={4} align='stretch'>
{yieldItem.metadata.deprecated && (
Expand All @@ -109,72 +76,41 @@ export const YieldInfoCard = memo(
)}

<Flex gap={4} align='center'>
{stackedIconElement}
{assetIcon}
<Heading as='h2' size='md'>
{yieldTitle}
</Heading>
<HStack spacing={2} flexWrap='wrap' ml='auto'>
<Tag borderRadius='full' px={3} textTransform='capitalize' alignSelf='stretch'>
{type}
</Tag>
{yieldItem.chainId && (
<Tag gap={1} borderRadius='full' p={2} textTransform='capitalize'>
<ChainIcon chainId={yieldItem.chainId} boxSize='20px' />
{yieldItem.network}
</Tag>
)}
{validatorOrProvider?.name && (
<Tag gap={1} borderRadius='full' p={2}>
{validatorOrProvider.logoURI && (
<Avatar
boxSize='20px'
src={validatorOrProvider.logoURI}
name={validatorOrProvider.name}
/>
)}
{validatorOrProvider.name}
</Tag>
)}
</HStack>
</Flex>

<HStack spacing={3} flexWrap='wrap'>
<Box
bg='background.surface.overlay.base'
borderRadius='full'
px={3}
py={1.5}
borderWidth={1}
borderColor='border.base'
>
<GradientApy fontSize='sm'>
<Box>
<GradientApy fontSize='4xl' fontWeight='medium'>
{apy}% {translate('common.apy')}
</GradientApy>
</Box>
<Badge
colorScheme='gray'
variant='subtle'
borderRadius='full'
px={3}
py={1.5}
fontWeight='medium'
fontSize='sm'
textTransform='capitalize'
>
{type}
</Badge>
</HStack>

<HStack spacing={6} flexWrap='wrap'>
<HStack spacing={2}>
{iconSource.assetId ? (
<AssetIcon assetId={iconSource.assetId} size='xs' />
) : (
<AssetIcon src={iconSource.src} size='xs' />
)}
<Text fontSize='md' fontWeight='semibold'>
{yieldItem.token.symbol}
</Text>
</HStack>
{yieldItem.chainId && (
<HStack spacing={2}>
<ChainIcon chainId={yieldItem.chainId} boxSize='20px' />
<Text fontSize='md' fontWeight='semibold' textTransform='capitalize'>
{yieldItem.network}
</Text>
</HStack>
)}
{validatorOrProvider?.name && (
<HStack spacing={2}>
{validatorOrProvider.logoURI && (
<Avatar
size='xs'
src={validatorOrProvider.logoURI}
name={validatorOrProvider.name}
/>
)}
<Text fontSize='md' fontWeight='semibold'>
{validatorOrProvider.name}
</Text>
</HStack>
)}
</HStack>

{description && (
Expand Down
20 changes: 4 additions & 16 deletions src/pages/Yields/components/YieldPositionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,16 +415,10 @@ export const YieldPositionCard = memo(

if (isBalancesLoading) {
return (
<Card variant='dashboard'>
<Card>
<CardBody p={{ base: 4, md: 5 }}>
<Flex justifyContent='space-between' alignItems='center' mb={4}>
<Heading
as='h3'
size='sm'
textTransform='uppercase'
color='text.subtle'
letterSpacing='wider'
>
<Heading as='h3' size='sm' color='text.subtle'>
{translate('yieldXYZ.myPosition')}
</Heading>
</Flex>
Expand All @@ -435,16 +429,10 @@ export const YieldPositionCard = memo(
}

return (
<Card variant='dashboard'>
<Card>
<CardBody p={{ base: 4, md: 5 }}>
<Flex justifyContent='space-between' alignItems='center' mb={4}>
<Heading
as='h3'
size='sm'
textTransform='uppercase'
color='text.subtle'
letterSpacing='wider'
>
<Heading as='h3' size='sm' color='text.subtle'>
{headingText}
Comment thread
gomesalexandre marked this conversation as resolved.
</Heading>
{addressBadge}
Expand Down
73 changes: 43 additions & 30 deletions src/pages/Yields/components/YieldProviderInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import { ExternalLinkIcon } from '@chakra-ui/icons'
import { Avatar, Box, Button, Flex, Heading, HStack, Link, Text } from '@chakra-ui/react'
import {
Avatar,
Box,
Button,
Card,
CardBody,
Flex,
Heading,
HStack,
Link,
Text,
} from '@chakra-ui/react'
import { memo, useMemo } from 'react'
import { useTranslate } from 'react-polyglot'

Expand Down Expand Up @@ -27,36 +38,38 @@ export const YieldProviderInfo = memo(
return (
<Box>
<Display.Desktop>
<Box bg='background.surface.raised.base' borderRadius='xl' p={6} mt={6}>
<Flex gap={6} align='flex-start'>
<Flex flex={1} direction='column' gap={4}>
<HStack spacing={3}>
{providerLogoURI && (
<Avatar size='md' src={providerLogoURI} name={providerName} />
)}
<Heading as='h3' size='md'>
{translate('yieldXYZ.aboutProvider', { provider: providerName })}
</Heading>
</HStack>
<Text color='text.subtle' fontSize='sm' lineHeight='tall'>
{description}
</Text>
{providerWebsite && (
<Link href={providerWebsite} isExternal ml={-2}>
<Button
variant='ghost'
size='sm'
rightIcon={<ExternalLinkIcon />}
color='text.subtle'
_hover={{ color: 'text.base' }}
>
{translate('yieldXYZ.visitWebsite')}
</Button>
</Link>
)}
<Card>
<CardBody>
<Flex gap={6} align='flex-start'>
<Flex flex={1} direction='column' gap={4}>
<HStack spacing={3}>
{providerLogoURI && (
<Avatar size='md' src={providerLogoURI} name={providerName} />
)}
<Heading as='h3' size='md'>
{translate('yieldXYZ.aboutProvider', { provider: providerName })}
</Heading>
{providerWebsite && (
<Link href={providerWebsite} isExternal ml='auto'>
<Button
variant='ghost'
size='sm'
rightIcon={<ExternalLinkIcon />}
color='text.subtle'
_hover={{ color: 'text.base' }}
>
{translate('yieldXYZ.visitWebsite')}
</Button>
</Link>
)}
</HStack>
<Text color='text.subtle' fontSize='sm' lineHeight='tall'>
{description}
</Text>
</Flex>
</Flex>
</Flex>
</Box>
</CardBody>
</Card>
</Display.Desktop>

<Display.Mobile>
Expand Down
Loading