Skip to content

Commit

Permalink
fix: UI issues and improvements (#386)
Browse files Browse the repository at this point in the history
* feat: UI bug fixes

* feat: update debt amount
  • Loading branch information
Rickk137 authored Aug 2, 2024
1 parent a070c78 commit 71844a4
Show file tree
Hide file tree
Showing 13 changed files with 365 additions and 215 deletions.
2 changes: 1 addition & 1 deletion liquidity/components/BorrowModal/BorrowModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export const BorrowModal: React.FC<{
const execBorrowWithErrorParser = useCallback(async () => {
try {
await execBorrow();
await queryClient.invalidateQueries({
queryClient.invalidateQueries({
queryKey: [`${network?.id}-${network?.preset}`, 'LiquidityPosition'],
exact: false,
});
Expand Down
5 changes: 4 additions & 1 deletion liquidity/components/ClaimModal/ClaimModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,13 @@ export const ClaimModal: React.FC<{
try {
await execBorrow();

await queryClient.invalidateQueries({
queryClient.invalidateQueries({
queryKey: [`${network?.id}-${network?.preset}`, 'LiquidityPosition'],
exact: false,
});
queryClient.invalidateQueries({
queryKey: [`${network?.id}-${network?.preset}`, 'TokenBalance'],
});
setDebtChange(ZEROWEI);
} catch (error: any) {
const contractError = errorParserCoreProxy(error);
Expand Down
1 change: 1 addition & 0 deletions liquidity/components/RepayModal/RepayModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ export const RepayModal: React.FC<{
queryKey: [`${network?.id}-${network?.preset}`, 'LiquidityPosition'],
}),
]);

setDebtChange(ZEROWEI);

toast.closeAll();
Expand Down
12 changes: 11 additions & 1 deletion liquidity/components/UndelegateModal/UndelegateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,20 @@ export const UndelegateModal: UndelegateModalProps = ({ onClose, isOpen, liquidi
await execUndelegate();
}

await queryClient.invalidateQueries({
queryClient.invalidateQueries({
queryKey: [`${network?.id}-${network?.preset}`, 'LiquidityPosition'],
exact: false,
});
queryClient.invalidateQueries({
queryKey: [`${network?.id}-${network?.preset}`, 'LiquidityPositions'],
});
queryClient.invalidateQueries({
queryKey: [
`${network?.id}-${network?.preset}`,
'AccountCollateralUnlockDate',
{ accountId: params.accountId },
],
});

setCollateralChange(ZEROWEI);
} catch (error: any) {
Expand Down
2 changes: 1 addition & 1 deletion liquidity/lib/validatePosition/validatePosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const validatePosition = ({
const maxDebt = maybeMaxDebt.gte(0) ? maybeMaxDebt : wei(0);

const isValid =
(debtChange.eq(0) && collateralChange.eq(0)) ||
(debtChange.lte(0) && collateralChange.gte(0)) ||
((newCRatio.gte(targetCRatio) || newCRatio.lte(0)) &&
(newDebt.lte(0) || newCollateralAmount.gt(0)));

Expand Down
Loading

0 comments on commit 71844a4

Please sign in to comment.