Skip to content

Commit

Permalink
feat: swap input handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ShawBit committed Aug 16, 2024
1 parent 6a099d1 commit 3ead1b8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/components/trade/SwapCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export default function SwapCard() {
setToken0AmountInput,
setToken1AmountInput,
updateTokenBalance,
token0AmountInputHandler,
token1AmountInputHandler,
maxHandler,
} = useSwap({
view: SwapView.swap,
Expand All @@ -43,6 +45,8 @@ export default function SwapCard() {
if (!swapData.token0 || !swapData.token1) return;
setToken0(swapData.token1);
setToken1(swapData.token0);
token0AmountInputHandler("");
token1AmountInputHandler("");
};

return (
Expand Down Expand Up @@ -167,7 +171,9 @@ export default function SwapCard() {
<span className="text-opacity-50 text-white flex items-center gap-x-1">
Price Impact: <Image alt="notice" src="/images/error.svg" className="w-[1rem] h-[1rem]" />
</span>
<span className="font-extrabold">{swapData.priceImpact}%</span>
<span className="font-extrabold">
{swapData.priceImpact ? `${swapData.priceImpact}%` : "---"}
</span>
</div>
<div className="flex justify-between">
<span className="text-opacity-50 text-white">Min.received:</span>
Expand Down

0 comments on commit 3ead1b8

Please sign in to comment.