"use client"; import Button from "@/lib/components/ui/Button"; import { cn } from "@/lib/utils"; import Link from "next/link"; import prettyBytes from "pretty-bytes"; import { HTMLAttributes } from "react"; import { UserStats } from "../../../lib/types/User"; import { BrainConsumption } from "./BrainConsumption"; import { DateComponent } from "./Date"; import BrainSpaceChart from "./Graphs/BrainSpaceChart"; import { RequestsPerDayChart } from "./Graphs/RequestsPerDayChart"; export const UserStatistics = (userStats: UserStats): JSX.Element => { const { email, current_brain_size, max_brain_size, date, requests_stats } = userStats; return ( <>

{email.split("@")[0] + "'"}s Brain Usage

{email}

{/* The last element corresponds to today's request_count */} Today{"'"}s Requests: {requests_stats.at(-1)?.requests_count}

Remaining Brain size

{/* How much brain space is left */} {prettyBytes(max_brain_size - current_brain_size, { binary: true, })} /{prettyBytes(max_brain_size - 0, { binary: true })}

); }; const UserStatisticsCard = ({ children, className, }: HTMLAttributes) => { return (
{children}
); }; export default UserStatistics;