diff --git a/frontend/src/app/workspace/chats/page.tsx b/frontend/src/app/workspace/chats/page.tsx index 1127faa..c53f085 100644 --- a/frontend/src/app/workspace/chats/page.tsx +++ b/frontend/src/app/workspace/chats/page.tsx @@ -1,17 +1,64 @@ "use client"; +import Link from "next/link"; +import { useMemo, useState } from "react"; + +import { Input } from "@/components/ui/input"; +import { ScrollArea } from "@/components/ui/scroll-area"; import { WorkspaceBody, WorkspaceContainer, WorkspaceHeader, } from "@/components/workspace/workspace-container"; +import { useThreads } from "@/core/threads/hooks"; +import { pathOfThread, titleOfThread } from "@/core/threads/utils"; +import { formatTimeAgo } from "@/core/utils/datetime"; export default function ChatsPage() { + const { data: threads } = useThreads(); + const [search, setSearch] = useState(""); + const filteredThreads = useMemo(() => { + return threads?.filter((thread) => { + return titleOfThread(thread).toLowerCase().includes(search.toLowerCase()); + }); + }, [threads, search]); return ( -
+
+
+ setSearch(e.target.value)} + /> +
+
+ +
+ {filteredThreads?.map((thread) => ( + +
+
+
{titleOfThread(thread)}
+
+
+ {formatTimeAgo(thread.updated_at)} +
+
+ + ))} +
+
+
+
);