mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-25 23:29:58 -07:00
parser: setup clap
This commit is contained in:
@@ -18,14 +18,14 @@ export function createResourceDataset<
|
||||
|
||||
const baseURL = `${
|
||||
location.hostname === "localhost"
|
||||
? "http://localhost:3111"
|
||||
? "http://localhost:3110"
|
||||
: "https://api.satonomics.xyz"
|
||||
// "https://api.satonomics.xyz"
|
||||
}${path}`;
|
||||
|
||||
const backupURL = `${
|
||||
location.hostname === "localhost"
|
||||
? "http://localhost:3111"
|
||||
? "http://localhost:3110"
|
||||
: "https://api-bkp.satonomics.xyz"
|
||||
}${path}`;
|
||||
|
||||
|
||||
@@ -8,6 +8,27 @@ const LOCAL_STORAGE_RANGE_KEY = "chart-range";
|
||||
const URL_PARAMS_RANGE_FROM_KEY = "from";
|
||||
const URL_PARAMS_RANGE_TO_KEY = "to";
|
||||
|
||||
export function setInitialTimeRange({
|
||||
chart,
|
||||
range,
|
||||
}: {
|
||||
chart: IChartApi;
|
||||
range: TimeRange;
|
||||
}) {
|
||||
if (range) {
|
||||
chart.timeScale().setVisibleRange(range);
|
||||
|
||||
// On small screen it doesn't it might not set it in time
|
||||
const timeout = setTimeout(() => {
|
||||
chart.timeScale().setVisibleRange(range);
|
||||
}, 50);
|
||||
|
||||
onCleanup(() => {
|
||||
clearTimeout(timeout);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function getInitialTimeRange(scale: ResourceScale): TimeRange {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
@@ -145,4 +166,4 @@ function saveTimeRange({
|
||||
localStorage.setItem(getLocalStorageKey(scale), JSON.stringify(range));
|
||||
}
|
||||
|
||||
const debouncedSaveTimeRange = debounce(saveTimeRange, 500);
|
||||
const debouncedSaveTimeRange = debounce(saveTimeRange, 250);
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
getInitialTimeRange,
|
||||
initTimeScale,
|
||||
setActiveIds,
|
||||
setInitialTimeRange,
|
||||
} from "../lightweightCharts/time";
|
||||
import { setWhitespace } from "../lightweightCharts/whitespace";
|
||||
import { colors } from "../utils/colors";
|
||||
@@ -121,9 +122,7 @@ export function applySeriesList({
|
||||
|
||||
const range = exactRange();
|
||||
|
||||
if (range) {
|
||||
chart.timeScale().setVisibleRange(range);
|
||||
}
|
||||
setInitialTimeRange({ chart, range });
|
||||
|
||||
if (chartIndex === 0) {
|
||||
initTimeScale({
|
||||
|
||||
Reference in New Issue
Block a user