mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 09:32:22 +03:00
886d30cf9e
* 🚚 move june analytics to folder and update paths * ✨ set up google analytics * ✨ sent firt GA event with react-ga * 🔒️ update security headers to include vercel and google analytics * 🚚 rename Vercel Analytics * ✨ use react-ga4 instread * 💚 fix tests
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { PropsWithChildren, useEffect } from "react";
|
|
|
|
import Footer from "@/lib/components/Footer";
|
|
import { NavBar } from "@/lib/components/NavBar";
|
|
import { useBrainContext } from "@/lib/context/BrainProvider/hooks/useBrainContext";
|
|
import { useSupabase } from "@/lib/context/SupabaseProvider";
|
|
import { UpdateMetadata } from "@/lib/helpers/updateMetadata";
|
|
import { usePageTracking } from "@/services/analytics/june/usePageTracking";
|
|
import "../lib/config/LocaleConfig/i18n";
|
|
|
|
const queryClient = new QueryClient();
|
|
|
|
// This wrapper is used to make effect calls at a high level in app rendering.
|
|
export const App = ({ children }: PropsWithChildren): JSX.Element => {
|
|
const { fetchAllBrains, fetchAndSetActiveBrain, fetchPublicPrompts } =
|
|
useBrainContext();
|
|
const { session } = useSupabase();
|
|
|
|
usePageTracking();
|
|
|
|
useEffect(() => {
|
|
void fetchAllBrains();
|
|
void fetchAndSetActiveBrain();
|
|
void fetchPublicPrompts();
|
|
}, [session?.user]);
|
|
|
|
return (
|
|
<QueryClientProvider client={queryClient}>
|
|
<NavBar />
|
|
<div className="flex-1">{children}</div>
|
|
<Footer />
|
|
<UpdateMetadata />
|
|
</QueryClientProvider>
|
|
);
|
|
};
|