You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
731 B
TypeScript
29 lines
731 B
TypeScript
import fs from "node:fs";
|
|
import { HourChart } from "./(charts)/hour";
|
|
import { DayChart } from "./(charts)/day";
|
|
import { MinuteChart } from "./(charts)/minute";
|
|
|
|
export default async function Home() {
|
|
const file = await fs.promises.readFile("./output.txt");
|
|
|
|
const lines = file.toString().split("\n");
|
|
|
|
const data = lines.map((line) => {
|
|
const [timestamp, event, value] = line.split(",");
|
|
return {
|
|
timestamp: Math.round(parseFloat(timestamp) * 1000),
|
|
foldtime: parseFloat(value),
|
|
};
|
|
});
|
|
|
|
console.log(data);
|
|
|
|
return (
|
|
<main className="flex-grow w-full flex flex-col justify-center gap-4 items-center p-4">
|
|
<MinuteChart data={data} />
|
|
<HourChart data={data} />
|
|
<DayChart data={data} />
|
|
</main>
|
|
);
|
|
}
|