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

add upcoming pools #1586

Merged
merged 3 commits into from
Sep 18, 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
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
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
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