Skip to content

Commit

Permalink
Cleanup LP closed stats (#336)
Browse files Browse the repository at this point in the history
* formats remove liquidity stats

* cleanup
  • Loading branch information
jackburrus authored Aug 15, 2023
1 parent 4435351 commit b521d2c
Showing 1 changed file with 19 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { adjustAmountByPercentage } from "@hyperdrive/core";
import { ConnectButton } from "@rainbow-me/rainbowkit";
import { MouseEvent, ReactElement } from "react";
import { Hyperdrive } from "src/appconfig/types";
import { Stat } from "src/ui/base/components/Stat";
import { formatBalance } from "src/ui/base/formatting/formatBalance";
import { useNumericInput } from "src/ui/base/hooks/useNumericInput";
import { usePreviewRemoveLiquidity } from "src/ui/hyperdrive/lp/hooks/usePreviewRemoveLiquidity";
Expand Down Expand Up @@ -53,6 +52,18 @@ export function RemoveLiquidityForm({
enabled: previewRemoveLiquidityStatus === "success",
});

const formattedBaseAmountOut =
baseAmountOut !== undefined
? `${formatBalance(
formatUnits(baseAmountOut, baseDecimals),
8,
)} ${baseSymbol}`
: null;

const formattedWithdrawalSharesOut = withdrawalSharesOut
? formatBalance(formatUnits(withdrawalSharesOut, baseDecimals), 8)
: null;

return (
<div className="flex flex-col gap-6">
{/* Amount to close section */}
Expand All @@ -73,29 +84,13 @@ export function RemoveLiquidityForm({
</div>

{/* You receive Section */}
<div className="space-y-4 text-center text-base-content">
<Stat
label={"You receive"}
value={
<>
{baseAmountOut !== undefined &&
`${formatBalance(
formatUnits(baseAmountOut, baseDecimals),
8,
)} ${baseSymbol}`}
{withdrawalSharesOut && (
<>
<br />
{formatBalance(
formatUnits(withdrawalSharesOut, baseDecimals),
8,
)}{" "}
Withdrawal shares
</>
)}
</>
}
/>
<div className="flex justify-between">
<p className="font-light text-neutral-content">You receive</p>
<p className="tracking-wide">{formattedBaseAmountOut}</p>
</div>
<div className="flex items-center justify-between">
<p className="font-light text-neutral-content">Withdrawal shares</p>
<p className="tracking-wide">{formattedWithdrawalSharesOut}</p>
</div>

{account ? (
Expand Down

2 comments on commit b521d2c

@vercel
Copy link

@vercel vercel bot commented on b521d2c Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hyperdrive-fixed-borrow – ./apps/fixed-borrow

hyperdrive-fixed-borrow-git-main-delvtech.vercel.app
hyperdrive-fixed-borrow.vercel.app
hyperdrive-fixed-borrow-delvtech.vercel.app

@vercel
Copy link

@vercel vercel bot commented on b521d2c Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hyperdrive-monorepo-hyperdrive-trading – ./apps/hyperdrive-trading

hyperdrive-monorepo-hyperdrive-trading-git-main-delvtech.vercel.app
hyperdrive-monorepo-hyperdrive-trading.vercel.app
hyperdrive-monorepo-hyperdrive-trading-delvtech.vercel.app

Please sign in to comment.