diff --git a/src/libs/routing/routes/sim.tsx b/src/libs/routing/routes/sim.tsx index 1faf93cb0..66f16c73a 100644 --- a/src/libs/routing/routes/sim.tsx +++ b/src/libs/routing/routes/sim.tsx @@ -204,6 +204,9 @@ export const simulatorResultRoute = new Route({ throw new Error('Invalid buy is range'); } + const type: SimulatorType = + search.type === 'overlapping' ? 'overlapping' : 'recurring'; + return { start: search.start, end: search.end, @@ -222,7 +225,7 @@ export const simulatorResultRoute = new Route({ buyIsRange: search.buyIsRange, // TODO add validation spread: search.spread, - type: search.type as SimulatorType, + type, }; }, // @ts-ignore diff --git a/src/libs/routing/utils.ts b/src/libs/routing/utils.ts index 42210903c..baab66182 100644 --- a/src/libs/routing/utils.ts +++ b/src/libs/routing/utils.ts @@ -10,7 +10,7 @@ function toValue(mix: string | undefined) { if (str === 'true') return true; if (str.startsWith('0x')) return str; if (str.startsWith('0X')) return str; - return +str * 0 === 0 && +str + '' === str ? +str : str; + return +str * 0 === 0 && +str + '' === str ? str : str; } export function decode(str: string) { @@ -51,7 +51,12 @@ export const parseSearchWith = (parser: (str: string) => any) => { const value = query[key]; if (typeof value === 'string') { try { - query[key] = parser(value); + const parsed = parser(value); + if (typeof parsed === 'number') { + query[key] = parsed.toString(); + } else { + query[key] = parsed; + } } catch (err) { // } diff --git a/src/pages/simulator/index.tsx b/src/pages/simulator/index.tsx index 525bce9e2..ec92bbfd9 100644 --- a/src/pages/simulator/index.tsx +++ b/src/pages/simulator/index.tsx @@ -23,20 +23,18 @@ export const SimulatorPage = () => { <>

Simulate Strategy

- {!isError && ( -
- - - -
- )} +
+ + + +
); diff --git a/src/pages/simulator/result/index.tsx b/src/pages/simulator/result/index.tsx index da019c76a..689bfd436 100644 --- a/src/pages/simulator/result/index.tsx +++ b/src/pages/simulator/result/index.tsx @@ -1,7 +1,9 @@ import { Link } from '@tanstack/react-router'; +import { SimulatorMobilePlaceholder } from 'components/simulator/mobile-placeholder'; import { SimResultChart } from 'components/simulator/result/SimResultChart'; import { SimResultSummary } from 'components/simulator/result/SimResultSummary'; import { useSimulator } from 'components/simulator/result/SimulatorProvider'; +import { useBreakpoints } from 'hooks/useBreakpoints'; import { useCallback, useEffect } from 'react'; import { ReactComponent as IconChevronLeft } from 'assets/icons/chevron-left.svg'; import { wait } from 'utils/helpers'; @@ -25,6 +27,10 @@ export const SimulatorResultPage = () => { handleAnimationStart(); }, [handleAnimationStart]); + const { aboveBreakpoint } = useBreakpoints(); + + if (!aboveBreakpoint('md')) return ; + return (
{simulationType === 'recurring' && (