-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(chat history): export a method to render just the chat history
- Loading branch information
1 parent
88bbd3b
commit 85d84e4
Showing
7 changed files
with
114 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React from "react"; | ||
import { ChatHistory } from "../components/ChatHistory"; | ||
import { useEventBusForSidebar } from "../hooks"; | ||
|
||
export const HistoryList: React.FC = () => { | ||
const { | ||
history, | ||
onDeleteHistoryItem, | ||
onOpenChatInSIdeBar, | ||
onOpenChatInTab, | ||
onCreateNewChat, | ||
} = useEventBusForSidebar(); | ||
|
||
return ( | ||
<ChatHistory | ||
history={history} | ||
onDeleteHistoryItem={onDeleteHistoryItem} | ||
onHistoryItemClick={onOpenChatInSIdeBar} | ||
onOpenChatInTab={onOpenChatInTab} | ||
onCreateNewChat={onCreateNewChat} | ||
/> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
export * from "../events"; | ||
export { render } from "./render"; | ||
export { render, renderHistoryList } from "./render"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from "react"; | ||
import { ConfigProvider, type Config } from "../../contexts/config-context.tsx"; | ||
import { HistoryList } from "../../features/HistoryList.tsx"; | ||
import ReactDOM from "react-dom/client"; | ||
import { Theme } from "../../components/Theme"; | ||
|
||
export function renderHistoryList(element: HTMLElement, config: Config) { | ||
const List: React.FC<Config> = (config) => { | ||
return ( | ||
<ConfigProvider config={config}> | ||
<Theme> | ||
<HistoryList /> | ||
</Theme> | ||
</ConfigProvider> | ||
); | ||
}; | ||
ReactDOM.createRoot(element).render(<List {...config} />); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters