From 754ddeaa8d3e3e4f3efc93d5bb22c68c31bb5c36 Mon Sep 17 00:00:00 2001 From: Ellie Huxtable Date: Mon, 6 May 2024 08:11:47 +0100 Subject: feat(ui): scroll history infinitely (#1999) * wip, history scrolls right! * wip * virtual scroll fucking worksssss * paging works :) * scroll search results now too --- ui/src/components/history/Stats.tsx | 67 ++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) (limited to 'ui/src/components/history/Stats.tsx') diff --git a/ui/src/components/history/Stats.tsx b/ui/src/components/history/Stats.tsx index ce92ac04..bc4e5c33 100644 --- a/ui/src/components/history/Stats.tsx +++ b/ui/src/components/history/Stats.tsx @@ -19,12 +19,60 @@ function renderLoading() { ); } +function TopTable({ stats }: any) { + console.log(stats); + return ( +
+
+
+

Top commands

+
+
+
+
+
+ + + + + + + + + {stats.map((stat) => ( + + + + + ))} + +
+ Command + + Count +
+ {stat[0][0]} + + {stat[1]} +
+
+
+
+
+ ); +} + export default function Stats() { const [stats, setStats]: any = useState([]); + const [top, setTop]: any = useState([]); const [chart, setChart]: any = useState([]); - console.log("Stats mounted"); - useEffect(() => { if (stats.length != 0) return; @@ -37,6 +85,10 @@ export default function Stats() { name: "Total history", stat: s.total_history.toLocaleString(), }, + { + name: "Unique history", + stat: s.stats.unique_commands.toLocaleString(), + }, { name: "Last 1d", stat: s.last_1d.toLocaleString(), @@ -52,20 +104,23 @@ export default function Stats() { ]); setChart(s.daily); + + setTop(s.stats); }) .catch((e) => { console.log(e); }); }, []); + console.log(top); if (stats.length == 0) { return renderLoading(); } return ( -
+
-
+
{stats.map((item: any) => (
+ +
+ +
); } -- cgit v1.3.1