Skip to content

Commit

Permalink
chore: Init
Browse files Browse the repository at this point in the history
  • Loading branch information
garethfuller committed Oct 16, 2024
1 parent 9ce8e29 commit 28f05ce
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export function PoolListTableHeader({ ...rest }) {
</GridItem>
<GridItem justifySelf="start">
<Text fontWeight="bold" textAlign="left">
Type
Details
</Text>
</GridItem>
{orderBy.map((orderByItem, index) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Box, Grid, GridItem, GridProps, Text } from '@chakra-ui/react'
import { Box, Grid, GridItem, GridProps, HStack, Text } from '@chakra-ui/react'
import Link from 'next/link'
import { getPoolPath, getPoolTypeLabel } from '../../pool.utils'
import MainAprTooltip from '@repo/lib/shared/components/tooltips/apr-tooltip/MainAprTooltip'
Expand All @@ -10,6 +10,9 @@ import { PoolListItem } from '../../pool.types'
import { PoolListTokenPills } from '../PoolListTokenPills'
import { getUserTotalBalanceUsd } from '../../user-balance.helpers'
import FadeInOnView from '@repo/lib/shared/components/containers/FadeInOnView'
import { isCowAmmPool } from '../../pool.helpers'
import { BalBadge } from '@repo/lib/shared/components/badges/BalBadge'
import { CowIcon } from '@repo/lib/shared/components/icons/logos/CowIcon'

interface Props extends GridProps {
pool: PoolListItem
Expand All @@ -18,6 +21,21 @@ interface Props extends GridProps {

const MemoizedMainAprTooltip = memo(MainAprTooltip)

function PoolVersionTag({ pool }: { pool: PoolListItem }) {
if (isCowAmmPool(pool.type)) {
return (
<BalBadge>
<CowIcon width={16} height={10} />
</BalBadge>
)
} else if (pool.protocolVersion === 3) {
return <BalBadge>v3</BalBadge>
} else if (pool.protocolVersion === 2) {
return <BalBadge>v2</BalBadge>
}
return null
}

export function PoolListTableRow({ pool, keyValue, ...rest }: Props) {
const { userAddress } = usePoolListQueryState()
const { toCurrency } = useCurrency()
Expand Down Expand Up @@ -48,10 +66,13 @@ export function PoolListTableRow({ pool, keyValue, ...rest }: Props) {
iconSize={20}
/>
</GridItem>
<GridItem>
<Text textAlign="left" fontWeight="medium" textTransform="capitalize">
{getPoolTypeLabel(pool.type)}
</Text>
<GridItem minW="32">
<HStack>
<PoolVersionTag pool={pool} />
<Text textAlign="left" fontWeight="medium" textTransform="capitalize">
{getPoolTypeLabel(pool.type)}
</Text>
</HStack>
</GridItem>
{userAddress && (
<GridItem>
Expand Down
21 changes: 21 additions & 0 deletions packages/lib/shared/components/badges/BalBadge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Badge, BadgeProps } from '@chakra-ui/react'

export function BalBadge({ children, ...props }: BadgeProps) {
return (
<Badge
fontWeight="normal"
py="xs"
px="sm"
background="background.level2"
border="1px solid"
borderColor="border.base"
shadow="sm"
rounded="full"
display="flex"
alignItems="center"
{...props}
>
{children}
</Badge>
)
}
4 changes: 2 additions & 2 deletions packages/lib/shared/components/icons/logos/CowIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-len */
export function CowIcon() {
export function CowIcon({ width = 36, height = 24 }: { width?: number; height?: number }) {
return (
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="24" fill="none">
<svg xmlns="http://www.w3.org/2000/svg" width={width} height={height} fill="none">
<path
fill="currentColor"
fillRule="evenodd"
Expand Down

0 comments on commit 28f05ce

Please sign in to comment.