quivr/frontend/app/chat/[chatId]/components/ChatDialogueArea/ChatDialogue.tsx
Mamadou DICKO 63e90a317c
feat: add onboarding first step (#1303)
* refactor: split <MessageRow /> into small components

* feat: add onboarding page first step
2023-10-03 11:25:16 +02:00

27 lines
858 B
TypeScript

import { useFeatureIsOn } from "@growthbook/growthbook-react";
import { useChatContext } from "@/lib/context";
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 shouldDisplayOnboarding = useFeatureIsOn("onboarding");
const shouldDisplayShortcuts =
chatItems.length === 0 && !shouldDisplayOnboarding;
if (!shouldDisplayShortcuts) {
return <ChatDialogue chatItems={chatItems} />;
}
return <ShortCuts />;
};