"use client"; import prettyBytes from "pretty-bytes"; import { useTranslation } from "react-i18next"; import Card, { CardBody, CardHeader } from "@/lib/components/ui/Card"; import Spinner from "@/lib/components/ui/Spinner"; import { useUserData } from "@/lib/hooks/useUserData"; 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 formatBrainSizeUsage = ( currentBrainSize: number, maxBrainSize: number ): string => { const sizeInUse = prettyBytes(maxBrainSize - currentBrainSize, { binary: true, }); const totalSize = prettyBytes(maxBrainSize - 0, { binary: true }); return `${sizeInUse} / ${totalSize}`; }; export const UserStatistics = (): JSX.Element => { const { userData }: { userData?: UserStats } = useUserData(); const { t } = useTranslation(["user"]); if (!userData) { return (
{formatBrainSizeUsage(current_brain_size, max_brain_size)}