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/HistoryList.tsx | 126 ++++++++++++++++++--------------- ui/src/components/HistorySearch.tsx | 12 ++-- ui/src/components/dotfiles/Aliases.tsx | 2 +- ui/src/components/history/Stats.tsx | 67 ++++++++++++++++-- 4 files changed, 139 insertions(+), 68 deletions(-) (limited to 'ui/src/components') diff --git a/ui/src/components/HistoryList.tsx b/ui/src/components/HistoryList.tsx index 9616ecf0..7cdeacd8 100644 --- a/ui/src/components/HistoryList.tsx +++ b/ui/src/components/HistoryList.tsx @@ -1,3 +1,4 @@ +import { useRef } from "react"; import { ChevronRightIcon } from "@heroicons/react/20/solid"; // @ts-ignore @@ -19,70 +20,81 @@ function msToTime(ms: number) { export default function HistoryList(props: any) { return ( - + + ); + })} + ); } diff --git a/ui/src/components/HistorySearch.tsx b/ui/src/components/HistorySearch.tsx index 08bed2a8..b3c8492a 100644 --- a/ui/src/components/HistorySearch.tsx +++ b/ui/src/components/HistorySearch.tsx @@ -3,12 +3,12 @@ import { ArrowPathIcon } from "@heroicons/react/24/outline"; import { MagnifyingGlassIcon } from "@heroicons/react/20/solid"; interface HistorySearchProps { - refresh: (query: string) => void; + query: string; + refresh: () => void; + setQuery: (query: string) => void; } export default function HistorySearch(props: HistorySearchProps) { - let [searchQuery, setSearchQuery] = useState(""); - return (
{ - setSearchQuery(query.target.value); - props.refresh(query.target.value); + props.setQuery(query.target.value); + props.refresh(); }} />
@@ -45,7 +45,7 @@ export default function HistorySearch(props: HistorySearchProps) { type="button" className="-m-2.5 p-2.5 text-gray-400 hover:text-gray-500" onClick={() => { - props.refresh(searchQuery); + props.refresh(); }} >