general: snapshot

This commit is contained in:
k
2024-07-25 14:43:20 +02:00
parent 0f8d7d5fe2
commit d3d5e7f8d7
27 changed files with 254 additions and 323 deletions
+9 -2
View File
@@ -123,7 +123,9 @@ function TextWrapper({
focused: Accessor<boolean>;
joined: string;
}) {
const seconds = joined.length * 2;
const p = createRWS(undefined as HTMLParagraphElement | undefined);
const seconds = createRWS(joined.length * 2);
const wasOnceOn = createRWS(false);
@@ -133,13 +135,18 @@ function TextWrapper({
}
});
onMount(() => {
seconds.set(Math.round(p()!.clientWidth / 20));
});
return (
<p
ref={p.set}
class="inline-block px-2 text-[5dvh] font-black uppercase leading-none"
style={{
...(wasOnceOn()
? {
animation: `marquee ${seconds}s linear infinite`,
animation: `marquee ${seconds()}s linear infinite`,
"animation-play-state":
focused() && mode.selected() === "Scroll"
? "running"
-38
View File
@@ -1,38 +0,0 @@
import { createResourceDataset } from "./resource";
export { averages } from "./consts/averages";
export function createScaleDatasets<Scale extends ResourceScale>({
scale,
groupedKeysToURLPath,
}: {
scale: Scale;
groupedKeysToURLPath: GroupedKeysToURLPath[Scale];
}) {
type Key = keyof typeof groupedKeysToURLPath;
type ResourceData = ReturnType<typeof createResourceDataset<Scale>>;
type ResourceDatasets = Record<Exclude<Key, "price">, ResourceData>;
const datasets = groupedKeysToURLPath as any as ResourceDatasets;
for (const key in groupedKeysToURLPath) {
if ((key as Key) !== "price") {
datasets[key as unknown as Exclude<Key, "price">] = createResourceDataset(
{
scale,
path: groupedKeysToURLPath[key as Key] as any,
},
);
}
}
const price = createResourceDataset<Scale, OHLC>({
scale,
path: `/${scale}-to-price`,
});
Object.assign(datasets, { price });
return datasets;
}
-36
View File
@@ -1,36 +0,0 @@
import { createResourceDataset } from "./resource";
export { averages } from "./consts/averages";
export function createDateDatasets({
groupedKeysToURLPath,
}: {
groupedKeysToURLPath: GroupedKeysToURLPath["date"];
}) {
type Key = keyof typeof groupedKeysToURLPath;
type ResourceData = ReturnType<typeof createResourceDataset<"date">>;
type ResourceDatasets = Record<Exclude<Key, "price">, ResourceData>;
const datasets = groupedKeysToURLPath as any as ResourceDatasets;
for (const key in groupedKeysToURLPath) {
if ((key as Key) !== "price") {
datasets[key as Exclude<Key, "price">] = createResourceDataset<"date">({
scale: "date",
path: groupedKeysToURLPath[key as Key],
});
}
}
const price = createResourceDataset<"date", OHLC>({
scale: "date",
path: "/date-to-price",
});
Object.assign(datasets, { price });
return datasets as ResourceDatasets & {
price: ResourceDataset<"date", OHLC>;
};
}
-34
View File
@@ -1,34 +0,0 @@
import { createResourceDataset } from "./resource";
export function createHeightDatasets({
groupedKeysToURLPath,
}: {
groupedKeysToURLPath: GroupedKeysToURLPath["height"];
}) {
type Key = keyof typeof groupedKeysToURLPath;
type ResourceData = ReturnType<typeof createResourceDataset<"height">>;
type ResourceDatasets = Record<Exclude<Key, "price">, ResourceData>;
const datasets = groupedKeysToURLPath as any as ResourceDatasets;
for (const key in groupedKeysToURLPath) {
if ((key as Key) !== "price") {
datasets[key as Exclude<Key, "price">] = createResourceDataset<"height">({
scale: "height",
path: groupedKeysToURLPath[key as Key],
});
}
}
const price = createResourceDataset<"height", OHLC>({
scale: "height",
path: "/height-to-price",
});
Object.assign(datasets, { price });
return datasets as ResourceDatasets & {
price: ResourceDataset<"height", OHLC>;
};
}
+2 -2
View File
@@ -5,8 +5,8 @@ export const scales = ["date" as const, "height" as const];
export const HEIGHT_CHUNK_SIZE = 10_000;
export function createDatasets() {
const date = new Map<DateDatasetPath, ResourceDataset<"date">>();
const height = new Map<HeightDatasetPath, ResourceDataset<"height">>();
const date = new Map<DatePath, ResourceDataset<"date">>();
const height = new Map<HeightPath, ResourceDataset<"height">>();
function getOrImport<Scale extends ResourceScale>(
scale: Scale,
+3 -12
View File
@@ -68,17 +68,8 @@ interface OHLC {
close: number;
}
type GroupedKeysToURLPath =
typeof import("/src/../../datasets/grouped_keys_to_url_path.json");
type DateDatasetPath = import("/src/../../datasets/paths").DatePath;
type HeightDatasetPath = import("/src/../../datasets/paths").HeightPath;
type LastDataPath = import("/src/../../datasets/paths").LastPath;
type DatasetPath<Scale extends ResourceScale> = Scale extends "date"
? DateDatasetPath
: HeightDatasetPath;
? DatePath
: HeightPath;
type AnyDatasetPath = DateDatasetPath | HeightDatasetPath;
type AnyDatasetPath = DatePath | HeightPath;
+1 -1
View File
@@ -18,7 +18,7 @@ export function createPresets(scale: ResourceScale) {
title: `Hodl Supply`,
description: "",
icon: IconTablerRipple,
unit: "Bitcoin",
unit: "Percentage",
bottom: [
{
title: `24h`,
@@ -1,4 +1,4 @@
import { averages } from "/src/scripts/datasets/date";
import { averages } from "/src/scripts/datasets/consts/averages";
import { colors } from "/src/scripts/utils/colors";
import { createRatioFolder } from "../../templates/ratio";
-8
View File
@@ -1,11 +1,3 @@
interface Dated {
date: string;
}
interface Heighted {
height: number;
}
interface Valued {
value: number;
}