Skip to content

Commit 6971ad2

Browse files
committed
bug fixes
1 parent 957d23a commit 6971ad2

File tree

2 files changed

+29
-17
lines changed

2 files changed

+29
-17
lines changed

frontend/src/pages/swap/[[...slug]].tsx

+28-16
Original file line numberDiff line numberDiff line change
@@ -352,22 +352,34 @@ function Page() {
352352
)
353353
return undefined;
354354

355-
const timestampsS = tokenInHistoricalUsdPrices
356-
.filter((_, index) => index % 10 === 0) // 1*10 = 10 minutes
357-
.map((item) => item.timestampS);
358-
359-
return timestampsS.map((timestampS) => ({
360-
timestampS,
361-
ratio: +new BigNumber(
362-
tokenInHistoricalUsdPrices.find(
363-
(item) => item.timestampS === timestampS,
364-
)?.value ?? 0,
365-
).div(
366-
tokenOutHistoricalUsdPrices.find(
367-
(item) => item.timestampS === timestampS,
368-
)?.value ?? 1,
369-
),
370-
}));
355+
const minTimestampS = Math.max(
356+
Math.min(...tokenInHistoricalUsdPrices.map((item) => item.timestampS)),
357+
Math.min(...tokenOutHistoricalUsdPrices.map((item) => item.timestampS)),
358+
);
359+
const maxTimestampS = Math.min(
360+
Math.max(...tokenInHistoricalUsdPrices.map((item) => item.timestampS)),
361+
Math.max(...tokenOutHistoricalUsdPrices.map((item) => item.timestampS)),
362+
);
363+
364+
const timestampsS: number[] = [minTimestampS];
365+
while (timestampsS[timestampsS.length - 1] < maxTimestampS) {
366+
timestampsS.push(timestampsS[timestampsS.length - 1] + 60 * 1); // 1 minute
367+
}
368+
369+
return timestampsS
370+
.filter((timestampS, index) => index % 10 === 0) // 1*10 = 10 minutes
371+
.map((timestampS) => ({
372+
timestampS,
373+
ratio: +new BigNumber(
374+
tokenInHistoricalUsdPrices.find(
375+
(item) => item.timestampS === timestampS,
376+
)?.value ?? 0,
377+
).div(
378+
tokenOutHistoricalUsdPrices.find(
379+
(item) => item.timestampS === timestampS,
380+
)?.value ?? 1,
381+
),
382+
}));
371383
})();
372384
const tokensRatio1DChange =
373385
tokensCurrentRatio !== undefined && tokensHistoricalRatios !== undefined

frontend/src/styles/globals.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ body {
381381
.react-flow__attribution {
382382
background: transparent !important;
383383
padding: 12px !important;
384-
opacity: 0.5;
384+
opacity: 0;
385385

386386
a {
387387
font-family: var(--font-geist-sans);

0 commit comments

Comments
 (0)