Skip to content

Commit 7ed41cc

Browse files
authored
Liquidated state: only show “claim remaining” when non zero (#820)
1 parent 628b693 commit 7ed41cc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

frontend/app/src/screens/LoanScreen/LoanScreen.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { useStoredState } from "@/src/services/StoredState";
1515
import { useTransactionFlow } from "@/src/services/TransactionFlow";
1616
import { isPrefixedtroveId } from "@/src/types";
1717
import { css } from "@/styled-system/css";
18-
import { Button, InfoTooltip, Tabs, TokenIcon } from "@liquity2/uikit";
18+
import { addressesEqual, Button, InfoTooltip, Tabs, TokenIcon } from "@liquity2/uikit";
1919
import { a, useTransition } from "@react-spring/web";
2020
import * as dn from "dnum";
2121
import { notFound, useRouter, useSearchParams, useSelectedLayoutSegment } from "next/navigation";
@@ -250,8 +250,11 @@ function ClaimCollateralSurplus({
250250
? dn.mul(collSurplus.data, collPriceUsd.data)
251251
: null;
252252

253-
// const isOwner = account.address && addressesEqual(account.address, loan.borrower);
254-
const isOwner = true;
253+
const isOwner = account.address && addressesEqual(account.address, loan.borrower);
254+
255+
if (!collSurplus.data || dn.eq(collSurplus.data, 0)) {
256+
return null;
257+
}
255258

256259
return (
257260
<div
@@ -358,7 +361,6 @@ function ClaimCollateralSurplus({
358361
],
359362
successLink: ["/", "Go to the dashboard"],
360363
successMessage: "The loan position has been closed successfully.",
361-
362364
borrower: loan.borrower,
363365
collIndex: loan.collIndex,
364366
collSurplus: collSurplus.data ?? dnum18(0),

0 commit comments

Comments
 (0)