From b43258660874ed626ec2b8c5fb1f7f043f1da2be Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Tue, 12 Jan 2021 17:32:13 +0100 Subject: [PATCH 1/2] feat: show pool with pool value of zero as upcoming --- tinlake-ui/components/PoolList/index.tsx | 3 ++- tinlake-ui/components/PoolTitle/index.tsx | 2 +- tinlake-ui/services/apollo/index.ts | 12 +++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/tinlake-ui/components/PoolList/index.tsx b/tinlake-ui/components/PoolList/index.tsx index b5cc1cf3c6..66b4cc57bf 100644 --- a/tinlake-ui/components/PoolList/index.tsx +++ b/tinlake-ui/components/PoolList/index.tsx @@ -92,7 +92,8 @@ class PoolList extends React.Component { {p.name}{' '} - {p.isUpcoming ? ( + {p.isUpcoming || + (p.seniorInterestRate && p.seniorInterestRate.isZero() === false && p.totalDebt.isZero()) ? ( ) : p.isArchived ? ( diff --git a/tinlake-ui/components/PoolTitle/index.tsx b/tinlake-ui/components/PoolTitle/index.tsx index 52bc507064..59d929148d 100644 --- a/tinlake-ui/components/PoolTitle/index.tsx +++ b/tinlake-ui/components/PoolTitle/index.tsx @@ -38,7 +38,7 @@ const PoolTitle: React.FC = (props: Props) => { {props.pool.metadata.name} - {props.pool.isUpcoming ? ( + {props.pool.isUpcoming || (pool?.data?.netAssetValue.isZero() && pool?.data?.reserve.isZero()) ? ( ) : ( isOversubscribed && diff --git a/tinlake-ui/services/apollo/index.ts b/tinlake-ui/services/apollo/index.ts index 2318f02235..4e2ef8b044 100644 --- a/tinlake-ui/services/apollo/index.ts +++ b/tinlake-ui/services/apollo/index.ts @@ -84,7 +84,7 @@ class Apollo { totalRepaysAggregatedAmountNum, weightedInterestRateNum, seniorInterestRateNum, - order: poolValueNum, + order: poolValueNum === 0 ? orderSummandPoolUpcoming : poolValueNum, isUpcoming: false, isArchived: false, isOversubscribed: (pool && new BN(pool.maxReserve).lte(new BN(pool.reserve))) || false, @@ -216,6 +216,7 @@ class Apollo { } catch (err) { throw new Error(`error occured while fetching assets from apollo ${err}`) } + let pools = result.data?.pools ? [ ...this.injectPoolData(result.data.pools, ipfsPools.active), @@ -275,6 +276,8 @@ class Apollo { data: [], } } + if (!result.data?.pools) return { data: [] } + const pool = result.data.pools[0] const tinlakeLoans = (pool && toTinlakeLoans(pool.loans)) || [] return tinlakeLoans @@ -341,12 +344,7 @@ class Apollo { const poolsDailyData = result.data.days.map((item: any) => { return { day: Number(item.id), - poolValue: parseFloat( - new BN(item.assetValue) - .add(new BN(item.reserve)) - .div(UintBase) - .toString() - ), + poolValue: parseFloat(new BN(item.assetValue).add(new BN(item.reserve)).div(UintBase).toString()), } }) From 68a75ee0f94bc711119b8636371ad279fa99f8f4 Mon Sep 17 00:00:00 2001 From: Jeroen Offerijns Date: Tue, 12 Jan 2021 17:42:49 +0100 Subject: [PATCH 2/2] chore: format --- tinlake-ui/services/apollo/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tinlake-ui/services/apollo/index.ts b/tinlake-ui/services/apollo/index.ts index 4e2ef8b044..c4732e5d8e 100644 --- a/tinlake-ui/services/apollo/index.ts +++ b/tinlake-ui/services/apollo/index.ts @@ -344,7 +344,12 @@ class Apollo { const poolsDailyData = result.data.days.map((item: any) => { return { day: Number(item.id), - poolValue: parseFloat(new BN(item.assetValue).add(new BN(item.reserve)).div(UintBase).toString()), + poolValue: parseFloat( + new BN(item.assetValue) + .add(new BN(item.reserve)) + .div(UintBase) + .toString() + ), } })