Skip to content

Commit

Permalink
remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
thal0x committed Dec 26, 2023
1 parent 4c8aba2 commit 5ed78b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
7 changes: 5 additions & 2 deletions src/components/SwapWidget/SwapWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import TransactionDialog from "../TransactionDialog";
import { UsdDiff } from "../UsdValue";
import { useWalletModal, WalletModal } from "../WalletModal";
import { SwapDetails } from "./SwapDetails";
import { useSwapWidget } from "./useSwapWidget";
import { PRICE_IMPACT_THRESHOLD, useSwapWidget } from "./useSwapWidget";

export const SwapWidget: FC = () => {
const { openWalletModal } = useWalletModal();
Expand Down Expand Up @@ -265,7 +265,10 @@ export const SwapWidget: FC = () => {
route={route}
transactionCount={numberOfTransactions}
insufficientBalance={insufficientBalance}
priceImpactThresholdReached={priceImpactThresholdReached}
shouldShowPriceImpactWarning={
priceImpactThresholdReached ||
Math.abs(usdDiffPercent * 100) > PRICE_IMPACT_THRESHOLD
}
/>
{insufficientBalance && (
<p className="text-center font-semibold text-sm text-red-500">
Expand Down
8 changes: 4 additions & 4 deletions src/components/TransactionDialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ interface Props {
route?: RouteResponse;
transactionCount: number;
insufficientBalance?: boolean;
priceImpactThresholdReached?: boolean;
shouldShowPriceImpactWarning?: boolean;
}

const TransactionDialog: FC<Props> = ({
isLoading,
route,
insufficientBalance,
transactionCount,
priceImpactThresholdReached,
shouldShowPriceImpactWarning,
}) => {
const [hasDisplayedWarning, setHasDisplayedWarning] = useState(false);
const [isOpen, setIsOpen] = useState(false);
Expand All @@ -38,7 +38,7 @@ const TransactionDialog: FC<Props> = ({
return;
}

if (priceImpactThresholdReached) {
if (shouldShowPriceImpactWarning) {
control.open();
setHasDisplayedWarning(true);
}
Expand All @@ -47,7 +47,7 @@ const TransactionDialog: FC<Props> = ({
setHasDisplayedWarning,
isOpen,
hasDisplayedWarning,
priceImpactThresholdReached,
shouldShowPriceImpactWarning,
]);

return (
Expand Down

0 comments on commit 5ed78b9

Please sign in to comment.