import { ArrowLeftIcon } from "@heroicons/react/24/outline"; import { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import styled from "styled-components"; import { table } from "table"; import { lightGray, vscBackground, vscInputBackground } from "../components"; import { CopyButton } from "../components/markdown/CopyButton"; import { useNavigationListener } from "../hooks/useNavigationListener"; import { ideRequest } from "../util/ide"; const Th = styled.th` padding: 0.5rem; text-align: left; border: 1px solid ${vscInputBackground}; `; const Tr = styled.tr` &:hover { background-color: ${vscInputBackground}; } overflow-wrap: anywhere; border: 1px solid ${vscInputBackground}; `; const Td = styled.td` padding: 0.5rem; border: 1px solid ${vscInputBackground}; `; function generateTable(data: unknown[][]) { return table(data); } function Stats() { useNavigationListener(); const navigate = useNavigate(); const [days, setDays] = useState<{ day: string; tokens: number }[]>([]); useEffect(() => { ideRequest("stats/getTokensPerDay", undefined).then((days) => { setDays(days); }); }, []); const [models, setModels] = useState<{ model: string; tokens: number }[]>([]); useEffect(() => { ideRequest("stats/getTokensPerModel", undefined).then((models) => { setModels(models); }); }, []); return (
navigate("/")} className="inline-block ml-4 cursor-pointer" />

My Usage

Tokens per Day

[day.day, day.tokens]), ), )} />
{days.map((day) => ( ))}
Day Tokens
{day.day} {day.tokens}

Tokens per Model

[model.model, model.tokens]), ), )} />
{models.map((model) => ( ))}
Model Tokens
{model.model} {model.tokens}
); } export default Stats;