threads history list

This commit is contained in:
Aneta Jastrzębska 2024-09-21 19:19:26 +02:00
parent 31cd10b9e6
commit e54f49ebfb

View file

@ -0,0 +1,27 @@
import React from "react"
import { ChatThread } from "../../shared_types"
import { useChat } from "../context"
const ThreadHistory = ({
threads,
}: {
threads: ChatThread[]
}) => {
const { selectThread } = useChat()
return (
<div className="flex flex-col space-y-1 mt-2">
{threads.map((thread) => (
<button
key={thread.id}
className="btn btn-secondary btn-sm"
onClick={() => selectThread(thread)}
>
{new Date(thread.createdAt).toLocaleString()}
</button>
))}
</div>
)
}
export default ThreadHistory