Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Jul 12, 2024
1 parent 46505b2 commit a408d9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export const columns = [
return fromAssetId && toAssetId && activeAssetId == fromAssetId.split('-')[1] ? (
<Text as="span" variant="body3">
{fromAssetName} &rarr;{' '}
<AnchorTextLink target="_self" href={`/pools/${toAssetId?.split('-')[0]}/assets/${toAssetId?.split('-')[1]}`}>
<AnchorTextLink target="_self" href={`#/pools/${toAssetId?.split('-')[0]}/assets/${toAssetId?.split('-')[1]}`}>
{toAssetName}
</AnchorTextLink>
</Text>
) : fromAssetId && toAssetId && activeAssetId == toAssetId.split('-')[1] ? (
<Text as="span" variant="body3">
<AnchorTextLink
target="_self"
href={`/pools/${fromAssetId?.split('-')[0]}/assets/${fromAssetId?.split('-')[1]}`}
href={`#/pools/${fromAssetId?.split('-')[0]}/assets/${fromAssetId?.split('-')[1]}`}
>
{fromAssetName}
</AnchorTextLink>{' '}
Expand All @@ -67,18 +67,18 @@ export const columns = [
<Text as="span" variant="body3">
<AnchorTextLink
target="_self"
href={`/pools/${fromAssetId?.split('-')[0]}/assets/${fromAssetId?.split('-')[1]}`}
href={`#/pools/${fromAssetId?.split('-')[0]}/assets/${fromAssetId?.split('-')[1]}`}
>
{fromAssetName}
</AnchorTextLink>{' '}
&rarr;{' '}
<AnchorTextLink target="_self" href={`/pools/${toAssetId?.split('-')[0]}/assets/${toAssetId?.split('-')[1]}`}>
<AnchorTextLink target="_self" href={`#/pools/${toAssetId?.split('-')[0]}/assets/${toAssetId?.split('-')[1]}`}>
{toAssetName}
</AnchorTextLink>
</Text>
) : activeAssetId != assetId?.split('-')[1] ? (
<Text as="span" variant="body3">
<AnchorTextLink target="_self" href={`/pools/${assetId?.split('-')[0]}/assets/${assetId?.split('-')[1]}`}>
<AnchorTextLink target="_self" href={`#/pools/${assetId?.split('-')[0]}/assets/${assetId?.split('-')[1]}`}>
{assetName || `Asset ${assetId?.split('-')[1]}`}
</AnchorTextLink>
</Text>
Expand Down
10 changes: 4 additions & 6 deletions centrifuge-app/src/utils/useLoans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Dec } from './Decimal'
import { useTinlakeLoans } from './tinlake/useTinlakePools'

export function useLoans(poolId: string) {
const isTinlakePool = poolId.startsWith('0x')
const isTinlakePool = poolId?.startsWith('0x')
const [centLoans] = useCentrifugeQuery(['loans', poolId], (cent) => cent.pools.getLoans([poolId]), {
suspense: true,
enabled: !isTinlakePool,
Expand All @@ -15,13 +15,11 @@ export function useLoans(poolId: string) {
}

export function useLoan(poolId: string | undefined, assetId: string | undefined) {
if(!poolId) return

const loans = useLoans(poolId)

return loans && [...loans].find((loan) => loan.id === assetId)
const loans = useLoans(poolId || '');
return loans?.find((loan) => loan.id === assetId);
}


export function useAvailableFinancing(poolId: string, assetId: string) {
const isTinlakePool = poolId.startsWith('0x')
const loan = useLoan(poolId, assetId)
Expand Down

0 comments on commit a408d9c

Please sign in to comment.