From 409d347ce2933e535102fe1c80be248355ff1ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B8b=C4=97rt=C3=B8?= <106074508+EchoDex@users.noreply.github.com> Date: Tue, 20 Feb 2024 13:10:44 +0400 Subject: [PATCH] fix: set input price if market selected --- .../LeftBlock/CreateOrderSpot/CreateOrderSpot.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpot.tsx b/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpot.tsx index 101fa63d..5653d1b0 100644 --- a/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpot.tsx +++ b/spark-frontend/src/screens/TradeScreen/LeftBlock/CreateOrderSpot/CreateOrderSpot.tsx @@ -1,4 +1,4 @@ -import React, { ComponentProps, useState } from "react"; +import React, { ComponentProps, useEffect, useState } from "react"; import styled from "@emotion/styled"; import { Accordion } from "@szhsin/react-accordion"; import { observer } from "mobx-react"; @@ -49,6 +49,12 @@ const CreateOrderSpot: React.FC = observer(({ ...rest }) => { const [orderType, setOrderType] = useState(ORDER_OPTIONS[0].key); + useEffect(() => { + if (orderType === ORDER_TYPE.Market) { + vm.setInputPrice(market?.price ?? BN.ZERO); + } + }); + if (!market) return null; const { baseToken, quoteToken } = market;