parser: setup clap

This commit is contained in:
k
2024-07-15 18:52:29 +02:00
parent 91f2427b44
commit ad51edbe07
22 changed files with 363 additions and 211 deletions
+21 -1
View File
@@ -1,6 +1,7 @@
import { run } from "/src/scripts/utils/run";
import { ButtonRandomChart } from "./button";
import { Box } from "./box";
import { Button, ButtonRandomChart } from "./button";
import { Header } from "./header";
import { Line } from "./line";
@@ -94,6 +95,25 @@ export function HistoryFrame({
<div class="h-[25dvh] flex-none" />
</div>
{/* <Box absolute="bottom">
<Button
onClick={() => {
// search.set("");
// inputRef()?.focus();
}}
>
Previous day
</Button>
<Button
onClick={() => {
// search.set("");
// inputRef()?.focus();
}}
>
Next day
</Button>
</Box> */}
</div>
);
}
+2 -2
View File
@@ -186,7 +186,7 @@ export function SearchFrame({
id={INPUT_PRESET_SEARCH_ID}
ref={inputRef.set}
class="w-full bg-transparent p-1 caret-orange-500 placeholder:text-orange-200/50 focus:outline-none"
placeholder="Search by name or path - / to focus"
placeholder="Search by name or path"
value={search()}
onFocus={initHaystackIfNeeded}
onInput={(event) => search.set(event.target.value)}
@@ -243,7 +243,7 @@ function ListSection({
);
return (
<div>
<div class="pb-16">
<For each={list()}>
{({ preset, path, title }) => (
<Line
+2 -2
View File
@@ -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}`;
+22 -1
View File
@@ -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);
+2 -3
View File
@@ -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({