diff --git a/webview-ui/src/components/HistoryView.tsx b/webview-ui/src/components/HistoryView.tsx
index 57ce3b6..14ab42e 100644
--- a/webview-ui/src/components/HistoryView.tsx
+++ b/webview-ui/src/components/HistoryView.tsx
@@ -1,6 +1,8 @@
-import { VSCodeButton } from "@vscode/webview-ui-toolkit/react"
+import { VSCodeButton, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
import { useExtensionState } from "../context/ExtensionStateContext"
import { vscode } from "../utils/vscode"
+import { Virtuoso } from "react-virtuoso"
+import { useMemo, useState } from "react"
type HistoryViewProps = {
onDone: () => void
@@ -8,6 +10,8 @@ type HistoryViewProps = {
const HistoryView = ({ onDone }: HistoryViewProps) => {
const { taskHistory } = useExtensionState()
+ const [searchQuery, setSearchQuery] = useState("")
+
const handleHistorySelect = (id: string) => {
vscode.postMessage({ type: "showTaskWithId", text: id })
}
@@ -35,6 +39,30 @@ const HistoryView = ({ onDone }: HistoryViewProps) => {
.toUpperCase()
}
+ const presentableTasks = useMemo(() => {
+ return taskHistory.filter((item) => item.ts && item.task)
+ }, [taskHistory])
+
+ const taskHistorySearchResults = useMemo(() => {
+ return presentableTasks.filter((item) => item.task.toLowerCase().includes(searchQuery.toLowerCase()))
+ }, [presentableTasks, searchQuery])
+
+ const highlightText = (text: string, query: string) => {
+ if (!query) return text
+ const parts = text.split(new RegExp(`(${query})`, "gi"))
+ return parts.map((part, index) =>
+ part.toLowerCase() === query.toLowerCase() ? (
+
+ {part}
+
+ ) : (
+ part
+ )
+ )
+ }
+
return (
<>