Skip to content

Commit

Permalink
add upcoming pools (#1586)
Browse files Browse the repository at this point in the history
* add upcoming pools

* reorder pools

* fix alignment
  • Loading branch information
JP authored Sep 18, 2023
1 parent aa1df75 commit 955d727
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 10 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>
)
}
7 changes: 4 additions & 3 deletions centrifuge-app/src/components/PoolFilter/SortButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ export type SortButtonProps = {
label: string
searchKey: SortBy
tooltip?: string
justifySelf?: 'start' | 'end'
}

type Sorting = {
isActive: boolean
direction: string | null
}

export function SortButton({ label, searchKey, tooltip }: SortButtonProps) {
export function SortButton({ label, searchKey, tooltip, justifySelf = 'end' }: SortButtonProps) {
const history = useHistory()
const { pathname, search } = useLocation()

Expand Down Expand Up @@ -58,7 +59,7 @@ export function SortButton({ label, searchKey, tooltip }: SortButtonProps) {
: `Sort ${label} ascending`
}
aria-live

Check warning on line 61 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / build-app

The value for aria-live must be a single token from the following: assertive,off,polite

Check warning on line 61 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / app-moonbeam-alpha / build-app

The value for aria-live must be a single token from the following: assertive,off,polite

Check warning on line 61 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / app-staging (altair) / build-app

The value for aria-live must be a single token from the following: assertive,off,polite

Check warning on line 61 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / app-staging (staging) / build-app

The value for aria-live must be a single token from the following: assertive,off,polite
style={{ justifySelf: 'end' }}
style={{ justifySelf }}
>
<FilterButton forwardedAs="span" variant="body3">
{label}
Expand All @@ -82,7 +83,7 @@ export function SortButton({ label, searchKey, tooltip }: SortButtonProps) {
: `Sort ${label} ascending`
}
aria-live

Check warning on line 85 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / build-app

The value for aria-live must be a single token from the following: assertive,off,polite

Check warning on line 85 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / app-moonbeam-alpha / build-app

The value for aria-live must be a single token from the following: assertive,off,polite

Check warning on line 85 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / app-staging (altair) / build-app

The value for aria-live must be a single token from the following: assertive,off,polite

Check warning on line 85 in centrifuge-app/src/components/PoolFilter/SortButton.tsx

View workflow job for this annotation

GitHub Actions / app-staging (staging) / build-app

The value for aria-live must be a single token from the following: assertive,off,polite
style={{ justifySelf: 'end' }}
style={{ justifySelf }}
>
{label}

Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/PoolFilter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function PoolFilter({ pools }: PoolFilterProps) {
tooltip="Value locked represents the current total value of pool tokens."
/>

<SortButton {...poolFilterConfig.apr} />
<SortButton {...poolFilterConfig.apr} justifySelf="start" />

<FilterMenu
{...poolFilterConfig.poolStatus}
Expand Down
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.08),
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
? [...upcomingPools, ...poolsToPoolCardProps(listedPools, centPoolsMetaDataById, cent)]
: [...upcomingPools]
const filteredPools = !!pools?.length ? filterPools(pools, new URLSearchParams(search)) : []

if (!listedPools.length) {
Expand Down

0 comments on commit 955d727

Please sign in to comment.