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

feat: show pool with pool value of zero as upcoming #100

Merged
merged 2 commits into from
Jan 12, 2021
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 tinlake-ui/components/PoolList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ class PoolList extends React.Component<Props> {
<Desc>
<Name>
{p.name}{' '}
{p.isUpcoming ? (
{p.isUpcoming ||
(p.seniorInterestRate && p.seniorInterestRate.isZero() === false && p.totalDebt.isZero()) ? (
<Label blue>Upcoming</Label>
) : p.isArchived ? (
<Label>Archived</Label>
Expand Down
2 changes: 1 addition & 1 deletion tinlake-ui/components/PoolTitle/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const PoolTitle: React.FC<Props> = (props: Props) => {
<PoolName>
{props.pool.metadata.name}
<PoolLabel>
{props.pool.isUpcoming ? (
{props.pool.isUpcoming || (pool?.data?.netAssetValue.isZero() && pool?.data?.reserve.isZero()) ? (
<Label blue>Upcoming</Label>
) : (
isOversubscribed && <Label orange>Oversubscribed</Label>
Expand Down
5 changes: 4 additions & 1 deletion tinlake-ui/services/apollo/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down