Skip to content

Commit

Permalink
add upcoming pools
Browse files Browse the repository at this point in the history
  • Loading branch information
JP Angelle committed Sep 16, 2023
1 parent 9122ad0 commit 48696b8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
3 changes: 2 additions & 1 deletion centrifuge-app/src/components/PoolCard/PoolStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { StatusChip, StatusChipProps } from '@centrifuge/fabric'
import * as React from 'react'

export type PoolStatusKey = 'Maker Pool' | 'Open for investments' | 'Closed'
export type PoolStatusKey = 'Maker Pool' | 'Open for investments' | 'Closed' | 'Upcoming'

const statusColor: { [key in PoolStatusKey]: StatusChipProps['status'] } = {
'Maker Pool': 'ok',
'Open for investments': 'info',
Closed: 'default',
Upcoming: 'default',
}

export function PoolStatus({ status }: { status?: PoolStatusKey }) {
Expand Down
7 changes: 4 additions & 3 deletions centrifuge-app/src/components/PoolCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Rate } from '@centrifuge/centrifuge-js'
import { Box, Grid, TextWithPlaceholder, Thumbnail } from '@centrifuge/fabric'
import { Box, Grid, Text, TextWithPlaceholder, Thumbnail } from '@centrifuge/fabric'
import Decimal from 'decimal.js-light'
import * as React from 'react'
import { useRouteMatch } from 'react-router'
Expand Down Expand Up @@ -70,7 +70,7 @@ export function PoolCard({
variant="body1"
color="textPrimary"
fontWeight={500}
textAlign="right"
textAlign="left"
isLoading={isLoading}
maxLines={1}
>
Expand All @@ -82,14 +82,15 @@ export function PoolCard({
})
: '—'}
</Ellipsis>
{status === 'Upcoming' ? <Text variant="body3"> target</Text> : ''}
</TextWithPlaceholder>

<Box>
<PoolStatus status={status} />
</Box>
</Grid>

<Anchor to={`${basePath}/${poolId}`} aria-label="Go to pool details" />
{status === 'Upcoming' ? null : <Anchor to={`${basePath}/${poolId}`} aria-label="Go to pool details" />}
</Root>
)
}
23 changes: 21 additions & 2 deletions centrifuge-app/src/pages/Pools.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Centrifuge, { Pool, PoolMetadata } from '@centrifuge/centrifuge-js'
import Centrifuge, { Pool, PoolMetadata, Rate } from '@centrifuge/centrifuge-js'
import { useCentrifuge } from '@centrifuge/centrifuge-react'
import { Box, InlineFeedback, Shelf, Stack, Text } from '@centrifuge/fabric'
import * as React from 'react'
Expand Down Expand Up @@ -39,7 +39,26 @@ function Pools() {
).map((q) => q.data)
const centPoolsMetaDataById = getMetasById(centPools, centPoolsMetaData)

const pools = !!listedPools?.length ? poolsToPoolCardProps(listedPools, centPoolsMetaDataById, cent) : []
const upcomingPools = [
{
apr: Rate.fromApr(0.085),
assetClass: 'Real Estate Bridge Loans',
iconUri: 'https://storage.googleapis.com/tinlake/pool-media/new-silver-2/icon.svg',
name: 'New Silver Series 3',
status: 'Upcoming' as PoolStatusKey,
},
{
apr: Rate.fromApr(0.15),
assetClass: 'Voluntary Carbon Offsets',
iconUri: 'https://storage.googleapis.com/tinlake/pool-media/flowcarbon-1/FlowcarbonBadge.svg',
name: 'Flowcarbon Nature Offsets Series 2',
status: 'Upcoming' as PoolStatusKey,
},
]

const pools = !!listedPools?.length
? [...poolsToPoolCardProps(listedPools, centPoolsMetaDataById, cent), ...upcomingPools]
: [...upcomingPools]
const filteredPools = !!pools?.length ? filterPools(pools, new URLSearchParams(search)) : []

if (!listedPools.length) {
Expand Down

0 comments on commit 48696b8

Please sign in to comment.