Skip to content

Commit

Permalink
Merge pull request #3260 from OlympusDAO/fixConsolidatebutton
Browse files Browse the repository at this point in the history
fix button display
  • Loading branch information
brightiron authored Jan 13, 2025
2 parents 7b455e5 + 7c7e3cd commit fbc64b3
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions src/views/Lending/Cooler/positions/Positions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,14 @@ export const CoolerPositions = () => {

console.log(allLoans, isFetchedLoansV1, isFetchedLoansV2, isFetchedLoansV3, address);
console.log(coolerAddressV1, coolerAddressV2, coolerAddressV3);

const shouldShowConsolidate =
allLoans.length > 1 ||
(((loansV1 && loansV1.length > 0) || (loansV2 && loansV2.length > 0)) &&
clearingHouses.v1 &&
clearingHouses.v2 &&
clearingHouses.v3);

return (
<div id="cooler-positions">
<Grid container spacing={2}>
Expand Down Expand Up @@ -274,26 +282,22 @@ export const CoolerPositions = () => {
>
Borrow {activeClearingHouse.debtAssetName} & Open Position
</PrimaryButton>
{allLoans.length > 1 ||
(((loansV1 && loansV1.length > 0) || (loansV2 && loansV2.length > 0)) &&
clearingHouses.v1 &&
clearingHouses.v2 &&
clearingHouses.v3 && (
<ConsolidateLoans
v3CoolerAddress={coolerAddressV3 || ""}
v2CoolerAddress={coolerAddressV2 || ""}
v1CoolerAddress={coolerAddressV1 || ""}
clearingHouseAddresses={{
v1: clearingHouses.v1,
v2: clearingHouses.v2,
v3: clearingHouses.v3,
}}
v1Loans={loansV1}
v2Loans={loansV2}
v3Loans={loansV3}
factoryAddress={clearingHouses.v3.factory}
/>
))}
{shouldShowConsolidate && clearingHouses.v1 && clearingHouses.v2 && clearingHouses.v3 && (
<ConsolidateLoans
v3CoolerAddress={coolerAddressV3 || ""}
v2CoolerAddress={coolerAddressV2 || ""}
v1CoolerAddress={coolerAddressV1 || ""}
clearingHouseAddresses={{
v1: clearingHouses.v1,
v2: clearingHouses.v2,
v3: clearingHouses.v3,
}}
v1Loans={loansV1}
v2Loans={loansV2}
v3Loans={loansV3}
factoryAddress={clearingHouses.v3.factory}
/>
)}
</Box>
)}
</>
Expand Down

0 comments on commit fbc64b3

Please sign in to comment.