Skip to content

Commit

Permalink
fix: undo previous changes (moving to separate branch)
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Dec 10, 2024
1 parent b989ce7 commit 87fc1f8
Showing 1 changed file with 9 additions and 24 deletions.
33 changes: 9 additions & 24 deletions packages/web/components/place-limit-tool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,19 @@ export const PlaceLimitTool: FunctionComponent<PlaceLimitToolProps> = observer(
? swapState.marketState.inAmountInput.setAmount
: swapState.marketState.outAmountInput.setAmount;

setQuoteType(
!isMarketOutAmount || !featureFlags.inGivenOut
? "out-given-in"
: "in-given-out"
);

// If value is empty clear values
if (!value || value.trim().length === 0) {
if (!value?.trim()) {
if (type === "market") {
setMarketAmount("");
setOppositeMarketAmount("");
}

if (fiatAmount.length > 0 || tokenAmount.length > 0) {
return update("");
}

return;
return update("");
}

const updatedValue = transformAmount(
Expand All @@ -328,21 +329,6 @@ export const PlaceLimitTool: FunctionComponent<PlaceLimitToolProps> = observer(
const formattedValue = !isFocused
? trimPlaceholderZeros(updatedValue)
: updatedValue;

if (amountType === "fiat" && fiatAmount === formattedValue) {
return;
}

if (amountType === "token" && tokenAmount === formattedValue) {
return;
}

setQuoteType(
!isMarketOutAmount || !featureFlags.inGivenOut
? "out-given-in"
: "in-given-out"
);

update(formattedValue);
},
[
Expand All @@ -355,8 +341,6 @@ export const PlaceLimitTool: FunctionComponent<PlaceLimitToolProps> = observer(
type,
resetSlippage,
featureFlags.inGivenOut,
fiatAmount,
tokenAmount,
]
);

Expand All @@ -368,6 +352,7 @@ export const PlaceLimitTool: FunctionComponent<PlaceLimitToolProps> = observer(
type === "market"
)
return;

const value = tokenAmount.length > 0 ? new Dec(tokenAmount) : undefined;
const fiatValue = value
? swapState.priceState.price.mul(value)
Expand Down

0 comments on commit 87fc1f8

Please sign in to comment.