2023-10-03 12:25:16 +03:00
|
|
|
import { useFeatureIsOn } from "@growthbook/growthbook-react";
|
|
|
|
|
2023-09-12 18:44:15 +03:00
|
|
|
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
|
|
|
|
);
|
2023-10-03 12:25:16 +03:00
|
|
|
const shouldDisplayOnboarding = useFeatureIsOn("onboarding");
|
2023-09-12 18:44:15 +03:00
|
|
|
|
2023-10-03 12:25:16 +03:00
|
|
|
const shouldDisplayShortcuts =
|
|
|
|
chatItems.length === 0 && !shouldDisplayOnboarding;
|
2023-09-12 18:44:15 +03:00
|
|
|
|
|
|
|
if (!shouldDisplayShortcuts) {
|
|
|
|
return <ChatDialogue chatItems={chatItems} />;
|
|
|
|
}
|
|
|
|
|
|
|
|
return <ShortCuts />;
|
|
|
|
};
|