diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/form.png b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/form.png index 6fa29648d..85290065e 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/form.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/form.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png index 3b36a0a86..e1c67756d 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/deposit/form.png b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/deposit/form.png index c3c0aeb8e..8890bbefd 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_limit/deposit/form.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_limit/deposit/form.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/form.png b/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/form.png index e83f73c35..2308c8c2b 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/form.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/form.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png b/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png index 96966af10..3ca441d01 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png and b/e2e/screenshots/strategy/disposable/Disposable_buy_range/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png b/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png index 1e9921cf3..e337cb851 100644 Binary files a/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png and b/e2e/screenshots/strategy/disposable/Disposable_sell_range/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png b/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png index 9315a9205..31467370a 100644 Binary files a/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png and b/e2e/screenshots/strategy/overlapping/Overlapping/editPrices/form.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png index 71253b06f..37f7557e5 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png and b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/form.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png index 88adc229d..cb4a229e6 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png and b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/duplicate/form.png b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/duplicate/form.png index 5c5088093..e0e3e6786 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_limit_limit/duplicate/form.png and b/e2e/screenshots/strategy/recurring/Recurring_limit_limit/duplicate/form.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png b/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png index a82096efc..8b4038cdd 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png and b/e2e/screenshots/strategy/recurring/Recurring_range_limit/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_range_limit/undercut/form.png b/e2e/screenshots/strategy/recurring/Recurring_range_limit/undercut/form.png index 59d7c9719..34f84efb5 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_range_limit/undercut/form.png and b/e2e/screenshots/strategy/recurring/Recurring_range_limit/undercut/form.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png b/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png index d8d030add..67d63a7d2 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png and b/e2e/screenshots/strategy/recurring/Recurring_range_range/create/my-strategy.png differ diff --git a/e2e/screenshots/strategy/recurring/Recurring_range_range/deposit/form.png b/e2e/screenshots/strategy/recurring/Recurring_range_range/deposit/form.png index 3ad9c07bc..5b9988887 100644 Binary files a/e2e/screenshots/strategy/recurring/Recurring_range_range/deposit/form.png and b/e2e/screenshots/strategy/recurring/Recurring_range_range/deposit/form.png differ diff --git a/src/components/simulator/input/overlapping/CreateOverlappingStrategy.tsx b/src/components/simulator/input/overlapping/CreateOverlappingStrategy.tsx index 30511e2ab..c23bedb49 100644 --- a/src/components/simulator/input/overlapping/CreateOverlappingStrategy.tsx +++ b/src/components/simulator/input/overlapping/CreateOverlappingStrategy.tsx @@ -47,6 +47,13 @@ export const CreateOverlappingStrategy: FC = (props) => { const [touched, setTouched] = useState(false); const [anchor, setAnchor] = useState<'buy' | 'sell' | undefined>(); + useEffect(() => { + // Hack: on focus from input while scrolling as it prevents reactive state to behave correctly + if (document.activeElement instanceof HTMLInputElement) { + document.activeElement.blur(); + } + }, [state.start]); + const { buyMarginal, sellMarginal } = useMemo(() => { const min = state.buy.min; const max = state.sell.max; diff --git a/src/pages/simulator/overlapping/index.tsx b/src/pages/simulator/overlapping/index.tsx index 1dfb0f2d9..005cba102 100644 --- a/src/pages/simulator/overlapping/index.tsx +++ b/src/pages/simulator/overlapping/index.tsx @@ -7,7 +7,7 @@ import { useSimulatorOverlappingInput } from 'hooks/useSimulatorOverlappingInput import { useGetTokenPriceHistory } from 'libs/queries/extApi/tokenPrice'; import { simulatorInputOverlappingRoute } from 'libs/routing/routes/sim'; import { defaultEnd, defaultStart } from 'components/strategies/common/utils'; -import { FormEvent, useEffect } from 'react'; +import { FormEvent, useEffect, useMemo } from 'react'; import { formatNumber, roundSearchParam } from 'utils/helpers'; export const SimulatorInputOverlappingPage = () => { @@ -24,6 +24,11 @@ export const SimulatorInputOverlappingPage = () => { end: defaultEnd().toString(), }); + const marketPrice = useMemo(() => { + if (!state.start) return data?.[0].open; + return data?.find((d) => d.date.toString() === state.start)?.open; + }, [data, state.start]); + useEffect(() => { if (searchState.sellMax || searchState.buyMin) return; dispatch('baseToken', searchState.baseToken); @@ -65,7 +70,7 @@ export const SimulatorInputOverlappingPage = () => { const { buyPriceMarginal, sellPriceMarginal } = calculateOverlappingPrices( formatNumber(state.buy.min), formatNumber(state.sell.max), - data[0].open.toString(), + marketPrice!.toString(), state.spread ); @@ -102,7 +107,7 @@ export const SimulatorInputOverlappingPage = () => { dispatch('spread', v)} />