Skip to content

Commit

Permalink
remove header
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasjm committed Jul 30, 2024
1 parent ce2b697 commit 4287f35
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 97 deletions.
58 changes: 2 additions & 56 deletions src/Histogram.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,52 +32,9 @@ function defined(x: Data | undefined): x is Data {
}
export function Histogram({}: Props): VNode {
const containerRef = useRef<HTMLDivElement>(null);
// const [data, setData] = useState<Data[]>();
const [goog, setGoog] = useState<d3.DSVParsedArray<object>>();
const [aapl, setAapl] = useState<d3.DSVParsedArray<object>>();
useEffect(() => {
// fetch("https://www.sebasjm.ar/assets/2023_data.json").then(d => {
// return d.text()
// }).then(s => {
// const asd = s.split("\n")
// const list = asd.map((line, idx) => {
// if (!line) return;
// const parsed = JSON.parse(line);
// if (idx < 10) {
// console.log(parsed)
// }
// const operation = parsed["Nombre de la Operacion"] as string
// // const when = new Date(parsed["Ano"], parsed["Mes"], parsed["Dia"])
// // setDay(when, parsed["Dia"])
// // setMonth(when, parsed["Mes"])
// // setYear(when, parsed["Ano"])
// // setSeconds(when, 0)
// // setMinutes(when, 0)
// // setHours(when, 0)
// const when = parse(parsed["Fecha de Servicio"], "MM/dd/yy HH:mm:ss", new Date())

// const value = parsed["Principal en Dolares"] as number
// // if (!value) {
// // return undefined;
// // }
// const interest = parsed["Interes en Dolares"] as number
// // console.log(parsed)
// return { operation, date: when, value, interest, raw: parsed }
// }).filter(defined)
// list.sort((a, b) => {
// const cmp = a.operation.localeCompare(b.operation)
// if (cmp) {
// return cmp;
// }
// return a.date.getTime() - b.date.getTime()
// })
// const smaller = list.slice(0, 100)

// setData(smaller)
// return null
// })
//
//
d3.csv("assets/data/goog.csv", d3.autoType).then((d) => {
setGoog(d);
});
Expand All @@ -91,23 +48,12 @@ export function Histogram({}: Props): VNode {
if (aapl === undefined) return;
if (containerRef.current === null) return;

// const plot = Plot.plot({
// // grid: true,
// // inset: 10,
// // aspectRatio: 1,
// x: { domain: [new Date("2024-03-01"), new Date("2024-5-01")] },
// marginLeft: 100,
// color: { legend: true },
// marks: [
// Plot.ruleY([0]),
// // Plot.lineY(smaller, { x: "when", y: "value" }),
// Plot.lineY(data, { x: "date", y: "value", stroke: "operation" }),
// ]
// });
const plot = Plot.plot({
style: "width: 100%;",
grid: true,
height: 300,
x: { label: "Fecha " },
y: { label: "Precio (ARS)" },
marks: [
Plot.lineY(goog, { x: "Date", y: "Close", stroke: "red" }),
Plot.lineY(aapl, { x: "Date", y: "Close", stroke: "blue" }),
Expand Down
50 changes: 45 additions & 5 deletions src/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
import { h } from "preact";
import { VNode, h } from "preact";
import { Histogram } from "./Histogram.js";

export function Home() {
return <div>
<Histogram />
</div>
}
return (
<div>
<header class="py-10 bg-gray-800 ">
<Deuda />
</header>
<div class="mx-auto max-w-7xl px-4 pb-12 sm:px-6 lg:px-8">
<div class="rounded-lg bg-white px-5 py-6 shadow sm:px-6">
<Histogram />
</div>
</div>
</div>
);
}

function Deuda(): VNode {
return (
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div class="flex justify-between">
<div class="text-3xl font-bold tracking-tight text-white">
Deuda Nacional
</div>
<div class="text-3xl font-bold tracking-tight text-white">
US $ 370.673.000.000,00
</div>
</div>
<div class="flex justify-between">
<div class="text-3xl font-bold tracking-tight text-white">
Deuda por persona
</div>
<div class="text-3xl font-bold tracking-tight text-white">
US $ 8.695,65
</div>
</div>
<div class="flex justify-between">
<div class="text-3xl font-bold tracking-tight text-white">
Producto bruto interno
</div>
<div class="text-3xl font-bold tracking-tight text-white">
US $ 631.000.000.000,00
</div>
</div>
</div>
);
}
38 changes: 2 additions & 36 deletions src/Routing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { assertUnreachable } from "./utils.js";
function AppFrame({ children }: { children: ComponentChildren }) {
return (
<div class="min-h-full">
<div class="bg-gray-800 pb-32">
<div class="bg-gray-800">
<nav class="bg-gray-800">
<div class="mx-auto max-w-7xl sm:px-6 lg:px-8">
<div class="border-b border-gray-700">
Expand Down Expand Up @@ -213,43 +213,9 @@ function AppFrame({ children }: { children: ComponentChildren }) {
</div>
</div>
</nav>
<header class="py-10">
<div class="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8">
<div class="flex justify-between">
<div class="text-3xl font-bold tracking-tight text-white">
Deuda Nacional
</div>
<div class="text-3xl font-bold tracking-tight text-white">
US $ 400.000.000.000,00
</div>
</div>
<div class="flex justify-between">
<div class="text-3xl font-bold tracking-tight text-white">
Deuda por persona
</div>
<div class="text-3xl font-bold tracking-tight text-white">
US $ 8.695,65
</div>
</div>
<div class="flex justify-between">
<div class="text-3xl font-bold tracking-tight text-white">
Producto bruto interno
</div>
<div class="text-3xl font-bold tracking-tight text-white">
US $ 631.000.000.000,00
</div>
</div>
</div>
</header>
</div>

<main class="-mt-32">
<div class="mx-auto max-w-7xl px-4 pb-12 sm:px-6 lg:px-8">
<div class="rounded-lg bg-white px-5 py-6 shadow sm:px-6">
{children}
</div>
</div>
</main>
<main>{children}</main>
</div>
);
}
Expand Down

0 comments on commit 4287f35

Please sign in to comment.