quivr/frontend/app/chat/[chatId]/components/ChatDialogueArea/ChatDialogue.tsx
2023-10-26 15:41:12 +02:00

25 lines
818 B
TypeScript

import { useChatContext } from "@/lib/context";
import { useOnboarding } from "@/lib/hooks/useOnboarding";
import { ChatDialogue } from "./components/ChatDialogue";
import { ShortCuts } from "./components/ShortCuts";
import { getMergedChatMessagesWithDoneStatusNotificationsReduced } from "./utils/getMergedChatMessagesWithDoneStatusNotificationsReduced";
export const ChatDialogueArea = (): JSX.Element => {
const { messages, notifications } = useChatContext();
const chatItems = getMergedChatMessagesWithDoneStatusNotificationsReduced(
messages,
notifications
);
const { isOnboarding } = useOnboarding();
const shouldDisplayShortcuts = chatItems.length === 0 && !isOnboarding;
if (!shouldDisplayShortcuts) {
return <ChatDialogue chatItems={chatItems} />;
}
return <ShortCuts />;
};