Skip to content

Commit

Permalink
refactor: refactored use of usememo in limit-price-selector
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Jul 1, 2024
1 parent 3bd9946 commit 5e33bf0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ export const LimitPriceSelector: FC<LimitPriceSelectorProps> = ({
);
}, [inputMode]);

const isAboveBelowMarketPrice = useMemo(() => {
return swapState.priceState.isBeyondOppositePrice;
}, [swapState.priceState.isBeyondOppositePrice]);

const priceLabel = useMemo(() => {
if (inputMode === InputMode.Percentage) {
return formatPretty(priceState.priceFiat);
Expand Down Expand Up @@ -103,8 +99,9 @@ export const LimitPriceSelector: FC<LimitPriceSelectorProps> = ({

<button
className={classNames("body2 inline-flex items-center gap-1", {
"text-rust-400": isAboveBelowMarketPrice,
"text-wosmongton-300": !isAboveBelowMarketPrice,
"text-rust-400": swapState.priceState.isBeyondOppositePrice,
"text-wosmongton-300":
!swapState.priceState.isBeyondOppositePrice,
})}
onClick={swapInputMode}
>
Expand All @@ -119,7 +116,7 @@ export const LimitPriceSelector: FC<LimitPriceSelectorProps> = ({
</div>
</SkeletonLoader>
<div className="">
{isAboveBelowMarketPrice && (
{swapState.priceState.isBeyondOppositePrice && (
<span className="body2 text-rust-400">
<Tooltip
content={TooltipContent}
Expand Down
1 change: 0 additions & 1 deletion packages/web/hooks/limit-orders/use-place-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ const useLimitPrice = ({
orderbookContractAddress: string;
orderDirection: OrderDirection;
}) => {
// TODO: Fetch spot price from SQS
const { data, isLoading } = api.edge.orderbooks.getOrderbookState.useQuery({
osmoAddress: orderbookContractAddress,
});
Expand Down

0 comments on commit 5e33bf0

Please sign in to comment.