diff --git a/apps/hyperdrive-trading/src/ui/base/components/LabelValue.tsx b/apps/hyperdrive-trading/src/ui/base/components/LabelValue.tsx
index 5c9be7f94..3ea22f3bc 100644
--- a/apps/hyperdrive-trading/src/ui/base/components/LabelValue.tsx
+++ b/apps/hyperdrive-trading/src/ui/base/components/LabelValue.tsx
@@ -1,6 +1,7 @@
import { InformationCircleIcon } from "@heroicons/react/24/outline";
import classNames from "classnames";
import { ReactNode } from "react";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
export function LabelValue({
size = "medium",
@@ -29,25 +30,20 @@ export function LabelValue({
"text-sm": size === "small",
})}
>
-
- {label}
- {tooltipContent ? (
+ })}
+ tooltip={tooltipContent}
+ >
+ {label}
- ) : null}
-
+
+ ) : (
+
diff --git a/apps/hyperdrive-trading/src/ui/base/components/Stat.tsx b/apps/hyperdrive-trading/src/ui/base/components/Stat.tsx
deleted file mode 100644
index acf344aa5..000000000
--- a/apps/hyperdrive-trading/src/ui/base/components/Stat.tsx
+++ /dev/null
@@ -1,66 +0,0 @@
-import { InformationCircleIcon } from "@heroicons/react/24/outline";
-import classNames from "classnames";
-import { ReactElement, ReactNode } from "react";
-
-export interface StatProps {
- label: ReactNode;
- value: ReactNode;
- description?: string;
- size?: "xsmall" | "small" | "large";
- horizontal?: boolean;
- tooltipPosition?: "top" | "bottom" | "left" | "right";
-}
-
-export function Stat({
- label,
- value,
- size = "large",
- description,
- horizontal,
- tooltipPosition = "bottom",
-}: StatProps): ReactElement {
- return (
-
-
- {value}
-
- {description ? (
-
- {label}
-
-
- ) : (
-
{label}
- )}
-
- );
-}
diff --git a/apps/hyperdrive-trading/src/ui/base/components/Tooltip/TextWithTooltip.tsx b/apps/hyperdrive-trading/src/ui/base/components/Tooltip/TextWithTooltip.tsx
deleted file mode 100644
index 8e3fd1536..000000000
--- a/apps/hyperdrive-trading/src/ui/base/components/Tooltip/TextWithTooltip.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-import classNames from "classnames";
-import { ReactElement, ReactNode } from "react";
-
-interface CellWithTooltipProps {
- label: ReactNode;
- tooltip: string;
-}
-
-export function TextWithTooltip({
- label,
- tooltip,
-}: CellWithTooltipProps): ReactElement {
- return (
-
- );
-}
diff --git a/apps/hyperdrive-trading/src/ui/base/components/Tooltip/Tooltip.tsx b/apps/hyperdrive-trading/src/ui/base/components/Tooltip/Tooltip.tsx
new file mode 100644
index 000000000..814421d7f
--- /dev/null
+++ b/apps/hyperdrive-trading/src/ui/base/components/Tooltip/Tooltip.tsx
@@ -0,0 +1,37 @@
+import classNames from "classnames";
+import { PropsWithChildren, ReactElement } from "react";
+
+interface CellWithTooltipProps extends PropsWithChildren {
+ className?: string;
+ tooltip?: string;
+ position?: "top" | "bottom" | "left" | "right";
+}
+
+export function Tooltip({
+ children,
+ className,
+ tooltip,
+ position = "top",
+}: CellWithTooltipProps): ReactElement {
+ if (!tooltip) {
+ return
{children}
;
+ }
+ return (
+
+ {children}
+
+ );
+}
diff --git a/apps/hyperdrive-trading/src/ui/base/components/WarningButton.tsx b/apps/hyperdrive-trading/src/ui/base/components/WarningButton.tsx
deleted file mode 100644
index e051df08c..000000000
--- a/apps/hyperdrive-trading/src/ui/base/components/WarningButton.tsx
+++ /dev/null
@@ -1,24 +0,0 @@
-export function WarningButton({
- label,
- icon,
- tooltip,
-}: {
- label: string;
- icon: React.ReactNode;
- tooltip?: string;
-}): JSX.Element {
- return (
-
-
-
- );
-}
diff --git a/apps/hyperdrive-trading/src/ui/hyperdrive/shorts/OpenShortForm/OpenShortForm.tsx b/apps/hyperdrive-trading/src/ui/hyperdrive/shorts/OpenShortForm/OpenShortForm.tsx
index 5c68079f5..eea11a871 100644
--- a/apps/hyperdrive-trading/src/ui/hyperdrive/shorts/OpenShortForm/OpenShortForm.tsx
+++ b/apps/hyperdrive-trading/src/ui/hyperdrive/shorts/OpenShortForm/OpenShortForm.tsx
@@ -19,6 +19,7 @@ import { getHasEnoughAllowance } from "src/token/getHasEnoughAllowance";
import { getHasEnoughBalance } from "src/token/getHasEnoughBalance";
import { LoadingButton } from "src/ui/base/components/LoadingButton";
import { PrimaryStat } from "src/ui/base/components/PrimaryStat";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
import { formatBalance } from "src/ui/base/formatting/formatBalance";
import { formatDate } from "src/ui/base/formatting/formatDate";
import { useNumericInput } from "src/ui/base/hooks/useNumericInput";
@@ -495,15 +496,14 @@ export function OpenShortForm({
}
unitClassName="mb-1 font-bold"
subValue={
-
What am I paying for?{" "}
-
+
}
/>
diff --git a/apps/hyperdrive-trading/src/ui/markets/AssetStack.tsx b/apps/hyperdrive-trading/src/ui/markets/AssetStack.tsx
index 6b0efb190..0f877829f 100644
--- a/apps/hyperdrive-trading/src/ui/markets/AssetStack.tsx
+++ b/apps/hyperdrive-trading/src/ui/markets/AssetStack.tsx
@@ -5,6 +5,7 @@ import {
getToken,
} from "@delvtech/hyperdrive-appconfig";
import { ReactElement } from "react";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
import { Address } from "viem";
export function AssetStack({
@@ -37,20 +38,20 @@ export function AssetStack({
}
>
{hyperdrive.depositOptions.isBaseTokenDepositEnabled ? (
-
-
{label}
-
+
+
-
+
) : (
""
)}{" "}
{currentValueLabel}
-
{isPositiveChangeInValue ? "+" : ""}
{baseAmountOut
? `${profitLoss === "-0" ? "0" : profitLoss}`
: undefined}
-
+
);
}
diff --git a/apps/hyperdrive-trading/src/ui/portfolio/lp/LpAndWithdrawalSharesTable/LpCurrentValueCell.tsx b/apps/hyperdrive-trading/src/ui/portfolio/lp/LpAndWithdrawalSharesTable/LpCurrentValueCell.tsx
index bd9ffe976..2200cd6db 100644
--- a/apps/hyperdrive-trading/src/ui/portfolio/lp/LpAndWithdrawalSharesTable/LpCurrentValueCell.tsx
+++ b/apps/hyperdrive-trading/src/ui/portfolio/lp/LpAndWithdrawalSharesTable/LpCurrentValueCell.tsx
@@ -9,6 +9,7 @@ import { ReactElement } from "react";
import Skeleton from "react-loading-skeleton";
import { calculateRatio } from "src/base/calculateRatio";
import { formatRate } from "src/base/formatRate";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
import { formatBalance } from "src/ui/base/formatting/formatBalance";
import { useOpenLpPosition } from "src/ui/hyperdrive/lp/hooks/useOpenLpPosition";
import { usePreviewRemoveLiquidity } from "src/ui/hyperdrive/lp/hooks/usePreviewRemoveLiquidity";
@@ -89,25 +90,23 @@ export function LpCurrentValueCell({
<>
{openLpPositionStatus === "loading" ? (
- ) : (
- baseValue && (
-
- {isPositiveChangeInValue ? "+" : "-"}
- {profitLoss === null ? : profitLoss.toString()}
-
- )
- )}
+ ) : baseValue ? (
+
+ {isPositiveChangeInValue ? "+" : "-"}
+ {profitLoss === null ? : profitLoss.toString()}
+
+ ) : null}
>
diff --git a/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentShortsValueCell.tsx b/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentShortsValueCell.tsx
index 58965d608..aeeb4e45e 100644
--- a/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentShortsValueCell.tsx
+++ b/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentShortsValueCell.tsx
@@ -8,6 +8,7 @@ import { ExclamationTriangleIcon } from "@heroicons/react/16/solid";
import classNames from "classnames";
import { ReactElement } from "react";
import Skeleton from "react-loading-skeleton";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
import { formatBalance } from "src/ui/base/formatting/formatBalance";
import { useIsTailwindSmallScreen } from "src/ui/base/mediaBreakpoints";
import { useEstimateShortMarketValue } from "src/ui/hyperdrive/shorts/hooks/useEstimateShortMarketValue";
@@ -79,32 +80,29 @@ export function CurrentShortsValueCell({
{previewCloseShortError ? (
-
-
+
) : (
""
)}{" "}
{currentValueLabel}
-
{isPositiveChangeInValue ? "+" : ""}
{profitLoss}
-
+
);
}
diff --git a/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentValueCell.tsx b/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentValueCell.tsx
index 42b44f1c1..3f3f22efc 100644
--- a/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentValueCell.tsx
+++ b/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/CurrentValueCell.tsx
@@ -8,6 +8,7 @@ import { ExclamationTriangleIcon } from "@heroicons/react/20/solid";
import classNames from "classnames";
import { ReactElement } from "react";
import Skeleton from "react-loading-skeleton";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
import { formatBalance } from "src/ui/base/formatting/formatBalance";
import { useIsTailwindSmallScreen } from "src/ui/base/mediaBreakpoints";
import { useEstimateShortMarketValue } from "src/ui/hyperdrive/shorts/hooks/useEstimateShortMarketValue";
@@ -80,12 +81,12 @@ export function CurrentValueCell({
TODO: Add "Current withdrawabale amount: xxx" to the tooltip once we
have calcMaxCloseShort */}
{previewCloseShortError ? (
-
-
+
) : (
""
)}{" "}
@@ -94,22 +95,19 @@ export function CurrentValueCell({
{/* the current value of the user's position */}
{currentValueInBase && openShort.bondAmount !== 0n ? (
-
{/* the Profit/Loss badge indicator */}
{isPositiveChangeInValue ? "+" : ""}
{profitLoss
? `${profitLoss === "-0" ? "" : `${profitLoss} ${baseToken.symbol}`}`
: undefined}
-
+
) : (
""
)}
diff --git a/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/ShortRateAndSizeCell.tsx b/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/ShortRateAndSizeCell.tsx
index 80b471254..ee7dff9d8 100644
--- a/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/ShortRateAndSizeCell.tsx
+++ b/apps/hyperdrive-trading/src/ui/portfolio/shorts/OpenShortsTable/ShortRateAndSizeCell.tsx
@@ -7,6 +7,7 @@ import { OpenShort } from "@delvtech/hyperdrive-js";
import classNames from "classnames";
import { ReactElement } from "react";
import { formatRate } from "src/base/formatRate";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
import { formatBalance } from "src/ui/base/formatting/formatBalance";
import { useFixedRate } from "src/ui/hyperdrive/longs/hooks/useFixedRate";
import { useBlock } from "wagmi";
@@ -43,12 +44,10 @@ export function ShortRateAndSizeCell({
{`${formatRate({ rate: short.fixedRatePaid })} APR`}
-
{isPositiveChangeInValue ? "+" : ""}
{formatRate({ rate: rateDifference })}
-
+
{`${formatBalance({
balance: short.bondAmount,
diff --git a/apps/hyperdrive-trading/src/ui/token/SlippageSettings.tsx b/apps/hyperdrive-trading/src/ui/token/SlippageSettings.tsx
index a0497bc68..11ca73334 100644
--- a/apps/hyperdrive-trading/src/ui/token/SlippageSettings.tsx
+++ b/apps/hyperdrive-trading/src/ui/token/SlippageSettings.tsx
@@ -5,6 +5,7 @@ import {
import classNames from "classnames";
import { ReactElement, useState } from "react";
import { PercentInput } from "src/ui/base/components/PercentInput";
+import { Tooltip } from "src/ui/base/components/Tooltip/Tooltip";
export const DEFAULT_SLIPPAGE_AMOUNT = "0.5";
@@ -45,12 +46,9 @@ export function SlippageSettings({