mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 17:43:03 +03:00
e2c1a027b0
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
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { PropsWithChildren, useEffect } from "react";
|
|
|
|
import { Menu } from "@/lib/components/Menu/Menu";
|
|
import { useOutsideClickListener } from "@/lib/components/Menu/hooks/useOutsideClickListener";
|
|
import { NotificationBanner } from "@/lib/components/NotificationBanner";
|
|
import { BrainProvider } from "@/lib/context";
|
|
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
|
import { SideBarProvider } from "@/lib/context/SidebarProvider/sidebar-provider";
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
import { UpdateMetadata } from "@/lib/helpers/updateMetadata";
|
|
import { usePageTracking } from "@/services/analytics/june/usePageTracking";
|
|
|
|
import "../lib/config/LocaleConfig/i18n";
|
|
|
|
// This wrapper is used to make effect calls at a high level in app rendering.
|
|
const App = ({ children }: PropsWithChildren): JSX.Element => {
|
|
const { fetchAllBrains, fetchDefaultBrain, fetchPublicPrompts } =
|
|
useBrainContext();
|
|
const { onClickOutside } = useOutsideClickListener();
|
|
const { session } = useSupabase();
|
|
|
|
usePageTracking();
|
|
|
|
useEffect(() => {
|
|
if (session?.user) {
|
|
void fetchAllBrains();
|
|
void fetchDefaultBrain();
|
|
void fetchPublicPrompts();
|
|
}
|
|
}, [session]);
|
|
|
|
return (
|
|
<div className="flex flex-1 flex-col overflow-auto">
|
|
<NotificationBanner />
|
|
<div className="relative h-full w-full flex justify-stretch items-stretch overflow-auto">
|
|
<Menu />
|
|
<div onClick={onClickOutside} className="flex-1">
|
|
{children}
|
|
</div>
|
|
<UpdateMetadata />
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const queryClient = new QueryClient();
|
|
|
|
const AppWithQueryClient = ({ children }: PropsWithChildren): JSX.Element => {
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<BrainProvider>
|
|
<SideBarProvider>
|
|
<App>{children}</App>
|
|
</SideBarProvider>
|
|
</BrainProvider>
|
|
</QueryClientProvider>
|
|
);
|
|
};
|
|
|
|
export { AppWithQueryClient as App };
|