Skip to content

Commit

Permalink
Hide archived pools by default (#1908)
Browse files Browse the repository at this point in the history
* Hide archived pools by default

* Fix upcoming pool filter
  • Loading branch information
sophialittlejohn authored Jan 25, 2024
1 parent 957087f commit 2d19752
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions centrifuge-app/src/components/PoolFilter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Grid, Text } from '@centrifuge/fabric'
import * as React from 'react'
import { COLUMNS, COLUMN_GAPS, PoolCardProps } from '../PoolCard'
import { PoolStatusKey } from '../PoolCard/PoolStatus'
import { poolFilterConfig } from './config'
import { FilterMenu } from './FilterMenu'
import { SortButton } from './SortButton'
Expand All @@ -9,16 +10,18 @@ type PoolFilterProps = {
pools?: PoolCardProps[]
}

const defaultPoolStatus: PoolStatusKey[] = ['Open for investments', 'Upcoming', 'Maker Pool', 'Closed', 'Archived']

export function PoolFilter({ pools }: PoolFilterProps) {
const [assetClasses, poolStatuses] = React.useMemo(() => {
if (!pools) {
return [[], []]
}

return [
[...new Set(pools.map(({ assetClass }) => assetClass).filter(Boolean))],
[...new Set(pools.map(({ status }) => status).filter(Boolean))],
] as [string[], string[]]
return [[...new Set(pools.map(({ assetClass }) => assetClass).filter(Boolean))], defaultPoolStatus] as [
string[],
PoolStatusKey[]
]
}, [pools])

return (
Expand Down
3 changes: 2 additions & 1 deletion centrifuge-app/src/components/PoolList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@ export function PoolList() {
.sort((a, b) => (b?.valueLocked && a?.valueLocked ? b?.valueLocked?.sub(a?.valueLocked).toNumber() : 0))
const tinlakePools = pools
.filter((pool) => pool?.poolId?.startsWith('0x'))
.filter((pool) => !pool?.status?.includes('Archived'))
.sort((a, b) => (b?.valueLocked && a?.valueLocked ? b.valueLocked.sub(a.valueLocked).toNumber() : 0))

const sortedPools = [...openInvestmentPools, ...upcomingPools, ...tinlakePools]
return search ? filterPools(pools, new URLSearchParams(search)) : sortedPools
return search ? filterPools([...pools, ...upcomingPools], new URLSearchParams(search)) : sortedPools
}, [listedPools, search])

Check warning on line 60 in centrifuge-app/src/components/PoolList.tsx

View workflow job for this annotation

GitHub Actions / deploy-development / webapp / build-app

React Hook React.useMemo has missing dependencies: 'cent' and 'centPoolsMetaDataById'. Either include them or remove the dependency array

Check warning on line 60 in centrifuge-app/src/components/PoolList.tsx

View workflow job for this annotation

GitHub Actions / deploy-ff-prod / webapp / build-app

React Hook React.useMemo has missing dependencies: 'cent' and 'centPoolsMetaDataById'. Either include them or remove the dependency array

Check warning on line 60 in centrifuge-app/src/components/PoolList.tsx

View workflow job for this annotation

GitHub Actions / app-staging / build-app

React Hook React.useMemo has missing dependencies: 'cent' and 'centPoolsMetaDataById'. Either include them or remove the dependency array

Check warning on line 60 in centrifuge-app/src/components/PoolList.tsx

View workflow job for this annotation

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

React Hook React.useMemo has missing dependencies: 'cent' and 'centPoolsMetaDataById'. Either include them or remove the dependency array

Check warning on line 60 in centrifuge-app/src/components/PoolList.tsx

View workflow job for this annotation

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

React Hook React.useMemo has missing dependencies: 'cent' and 'centPoolsMetaDataById'. Either include them or remove the dependency array

if (!listedPools.length) {
Expand Down

0 comments on commit 2d19752

Please sign in to comment.