Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - <PoolMetaBadges> #137

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 3 additions & 2 deletions lib/modules/pool/PoolDetail/PoolDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import PoolStats from './PoolStats'
import PoolMyLiquidity from './PoolMyLiquidity'
import PoolIncentives from './PoolIncentives'
import { PoolAccordion } from './PoolAccordion/PoolAccordion'
import PoolMetaBadges from './PoolMetaBadges/PoolMetaBadges'

export function PoolDetail() {
return (
<Stack width="full">
{/* {loading && <Text>Loading...</Text>} */}

<VStack width="full" spacing="16">
<VStack width="full" spacing="5">
<VStack alignItems="flex-start" width="full" spacing="5">
<PoolMetaBadges />
<PoolStats />
<HStack width="full" spacing="4">
<PoolMyLiquidity />
Expand Down
66 changes: 66 additions & 0 deletions lib/modules/pool/PoolDetail/PoolMetaBadges/PoolMetaBadges.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Badge, HStack, Text, Tooltip } from '@chakra-ui/react'
import { usePool } from '../../usePool'
import { TokenIcon } from '@/lib/modules/tokens/TokenIcon'
import Image from 'next/image'
import { fNum } from '@/lib/shared/utils/numbers'

export default function PoolMetaBadges() {
const { pool, chain } = usePool()

console.log('lmao', pool)
return (
<HStack>
<Badge
py="2.5"
px="3"
rounded="full"
background="lightBadge"
_dark={{ background: 'background.card.level6' }}
Comment on lines +17 to +18
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you guys think, I can themify this. I didn't think it needed it however.

>
<Image
src={`/images/chains/${chain}.svg`}
alt={`Chain icon for ${chain.toLowerCase()}`}
width={20}
height={20}
/>
</Badge>
{pool.displayTokens.map(token => {
return (
<Badge
py="2"
px="3"
rounded="full"
background="lightBadge"
_dark={{ background: 'background.card.level6' }}
key={`meta-badge-${token.address}`}
>
<HStack>
<TokenIcon
chain={chain}
address={token.address}
size={24}
alt={token?.symbol || token.address}
/>
<Text fontSize="1rem">{token.symbol}</Text>
{token.weight && (
<Text fontWeight="normal" fontSize="1rem">
{fNum('weight', token.weight || 0)}
</Text>
)}
</HStack>
</Badge>
)
})}
<Tooltip label="Swap fee">
<Badge
fontWeight="normal"
p="1"
background="lightBadge"
_dark={{ background: 'background.card.level6' }}
>
<Text>{fNum('feePercent', pool.dynamicData.swapFee)}</Text>
</Badge>
</Tooltip>
</HStack>
)
}