|
|
|
|
@ -9,16 +9,17 @@ import {
|
|
|
|
|
CardContent,
|
|
|
|
|
CardFooter,
|
|
|
|
|
CardHeader,
|
|
|
|
|
CardTitle,
|
|
|
|
|
} from "@/components/ui/card";
|
|
|
|
|
|
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
|
|
|
|
|
|
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, _, value] = line.split(",");
|
|
|
|
|
const [timestamp, , value] = line.split(",");
|
|
|
|
|
return {
|
|
|
|
|
timestamp: Math.round(parseFloat(timestamp) * 1000),
|
|
|
|
|
foldtime: parseFloat(value),
|
|
|
|
|
@ -35,7 +36,7 @@ export default async function Home() {
|
|
|
|
|
<div className="flex flex-col gap-2 items-start p-4">
|
|
|
|
|
<span className="text-muted-foreground">This Month</span>
|
|
|
|
|
<h2 className="text-2xl font-bold">
|
|
|
|
|
{thisMonthData.reduce((acc, curr) => {
|
|
|
|
|
{thisMonthData.reduce((acc) => {
|
|
|
|
|
return acc + 1;
|
|
|
|
|
}, 0)}
|
|
|
|
|
{" Towel(s)"}
|
|
|
|
|
@ -50,7 +51,7 @@ export default async function Home() {
|
|
|
|
|
<div className="flex flex-col gap-2 items-start p-4">
|
|
|
|
|
<span className="text-muted-foreground">Today</span>
|
|
|
|
|
<h2 className="text-2xl font-bold">
|
|
|
|
|
{todayData.reduce((acc, curr) => {
|
|
|
|
|
{todayData.reduce((acc) => {
|
|
|
|
|
return acc + 1;
|
|
|
|
|
}, 0)}
|
|
|
|
|
{" Towel(s)"}
|
|
|
|
|
@ -65,7 +66,7 @@ export default async function Home() {
|
|
|
|
|
<div className="flex flex-col gap-2 items-start p-4">
|
|
|
|
|
<span className="text-muted-foreground">This Month</span>
|
|
|
|
|
<h2 className="text-2xl font-bold">
|
|
|
|
|
{thisMonthData.reduce((acc, curr) => {
|
|
|
|
|
{thisMonthData.reduce((acc) => {
|
|
|
|
|
return acc + 1;
|
|
|
|
|
}, 0)}
|
|
|
|
|
{" Towel(s)"}
|
|
|
|
|
|