quivr/frontend/app/chat/[chatId]/page.tsx
Mamadou DICKO e2c1a027b0
feat: add chat view new design (#1897)
Issue: https://github.com/StanGirard/quivr/issues/1888

- Add Spinner when history is loading
- Change chat messages fetching logic
- Add cha view new design

Demo:



https://github.com/StanGirard/quivr/assets/63923024/c4341ccf-bacd-4720-9aa1-127dd557a75c
2023-12-14 16:22:09 +01:00

47 lines
1.6 KiB
TypeScript

"use client";
import { useMenuWidth } from "@/lib/components/Menu/hooks/useMenuWidth";
import { useKnowledgeToFeedContext } from "@/lib/context/KnowledgeToFeedProvider/hooks/useKnowledgeToFeedContext";
import { useCustomDropzone } from "@/lib/hooks/useDropzone";
import { cn } from "@/lib/utils";
import { ActionsBar } from "./components/ActionsBar";
import { ChatDialogueArea } from "./components/ChatDialogueArea/ChatDialogue";
import { useChatNotificationsSync } from "./hooks/useChatNotificationsSync";
import { useChatsList } from "./hooks/useChatsList";
const SelectedChatPage = (): JSX.Element => {
const { getRootProps } = useCustomDropzone();
const { shouldDisplayFeedCard } = useKnowledgeToFeedContext();
const { staticMenuWidth } = useMenuWidth();
useChatsList();
useChatNotificationsSync();
return (
<div className="flex flex-1">
<div
className={cn(
"flex flex-col flex-1 items-center justify-stretch w-full h-full overflow-hidden",
shouldDisplayFeedCard ? "bg-chat-bg-gray" : "bg-tertiary",
"dark:bg-black transition-colors ease-out duration-500"
)}
data-testid="chat-page"
{...getRootProps()}
>
<div
className={`flex flex-col flex-1 w-full max-w-5xl h-full dark:shadow-primary/25 overflow-hidden p-2 sm:p-4 md:p-6 lg:p-8`}
>
<div className="flex flex-1 flex-col overflow-y-auto">
<ChatDialogueArea />
</div>
<ActionsBar />
</div>
</div>
<div className="h-full bg-highlight" style={{ width: staticMenuWidth }} />
</div>
);
};
export default SelectedChatPage;