mirror of
https://github.com/voideditor/void
synced 2026-05-24 09:58:23 +00:00
threads history list
This commit is contained in:
parent
31cd10b9e6
commit
e54f49ebfb
1 changed files with 27 additions and 0 deletions
27
extensions/void/src/sidebar/components/ThreadHistory.tsx
Normal file
27
extensions/void/src/sidebar/components/ThreadHistory.tsx
Normal 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
|
||||
Loading…
Reference in a new issue