remove posthog client on survey frontend

This commit is contained in:
Matthias Nannt
2023-04-20 15:00:15 +02:00
parent 9a494a3f8a
commit 90eaab9c9e
6 changed files with 37 additions and 21 deletions
+12 -9
View File
@@ -1,6 +1,7 @@
import { Logo } from "@/components/Logo"; import { Logo } from "@/components/Logo";
import { getServerSession } from "next-auth"; import { getServerSession } from "next-auth";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { PosthogClientWrapper } from "../PosthogClientWrapper";
export default async function AuthLayout({ children }: { children: React.ReactNode }) { export default async function AuthLayout({ children }: { children: React.ReactNode }) {
const session = await getServerSession(); const session = await getServerSession();
@@ -8,19 +9,21 @@ export default async function AuthLayout({ children }: { children: React.ReactNo
redirect(`/`); redirect(`/`);
} }
return ( return (
<div className="min-h-screen bg-slate-50"> <PosthogClientWrapper>
<div className="isolate bg-white"> <div className="min-h-screen bg-slate-50">
<div className="bg-gradient-radial flex min-h-screen from-slate-200 to-slate-50"> <div className="isolate bg-white">
<div className="mx-auto flex flex-1 flex-col justify-center px-4 py-12 sm:px-6 lg:flex-none lg:px-20 xl:px-24"> <div className="bg-gradient-radial flex min-h-screen from-slate-200 to-slate-50">
<div className="mx-auto w-full max-w-sm rounded-xl bg-white p-8 shadow-xl lg:w-96"> <div className="mx-auto flex flex-1 flex-col justify-center px-4 py-12 sm:px-6 lg:flex-none lg:px-20 xl:px-24">
<div className="mb-8 text-center"> <div className="mx-auto w-full max-w-sm rounded-xl bg-white p-8 shadow-xl lg:w-96">
<Logo className="mx-auto w-3/4" /> <div className="mb-8 text-center">
<Logo className="mx-auto w-3/4" />
</div>
{children}
</div> </div>
{children}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </PosthogClientWrapper>
); );
} }
@@ -0,0 +1,5 @@
import { PosthogClientWrapper } from "../PosthogClientWrapper";
export default async function AuthLayout({ children }: { children: React.ReactNode }) {
return <PosthogClientWrapper>{children}</PosthogClientWrapper>;
}
@@ -5,6 +5,7 @@ import { redirect } from "next/navigation";
import { authOptions } from "pages/api/auth/[...nextauth]"; import { authOptions } from "pages/api/auth/[...nextauth]";
import PosthogIdentify from "./PosthogIdentify"; import PosthogIdentify from "./PosthogIdentify";
import FormbricksClient from "./FormbricksClient"; import FormbricksClient from "./FormbricksClient";
import { PosthogClientWrapper } from "../../PosthogClientWrapper";
export default async function EnvironmentLayout({ children, params }) { export default async function EnvironmentLayout({ children, params }) {
const session = await getServerSession(authOptions); const session = await getServerSession(authOptions);
@@ -18,10 +19,12 @@ export default async function EnvironmentLayout({ children, params }) {
<FormbricksClient session={session} /> <FormbricksClient session={session} />
<ToasterClient /> <ToasterClient />
<EnvironmentsNavbar environmentId={params.environmentId} session={session} /> <EnvironmentsNavbar environmentId={params.environmentId} session={session} />
<main className="h-full flex-1 overflow-y-auto bg-slate-50"> <PosthogClientWrapper>
{children} <main className="h-full flex-1 overflow-y-auto bg-slate-50">
<main /> {children}
</main> <main />
</main>
</PosthogClientWrapper>
</> </>
); );
} }
+5
View File
@@ -0,0 +1,5 @@
import { PosthogClientWrapper } from "../PosthogClientWrapper";
export default async function AuthLayout({ children }: { children: React.ReactNode }) {
return <PosthogClientWrapper>{children}</PosthogClientWrapper>;
}
+1 -4
View File
@@ -1,4 +1,3 @@
import { PosthogClientWrapper } from "@/app/PosthogClientWrapper";
import "./globals.css"; import "./globals.css";
export const metadata = { export const metadata = {
@@ -9,9 +8,7 @@ export const metadata = {
export default function RootLayout({ children }: { children: React.ReactNode }) { export default function RootLayout({ children }: { children: React.ReactNode }) {
return ( return (
<html lang="en"> <html lang="en">
<body className="flex h-screen flex-col bg-slate-50"> <body className="flex h-screen flex-col bg-slate-50">{children}</body>
<PosthogClientWrapper>{children}</PosthogClientWrapper>
</body>
</html> </html>
); );
} }
+7 -4
View File
@@ -3,6 +3,7 @@ import { getServerSession } from "next-auth";
import { redirect } from "next/navigation"; import { redirect } from "next/navigation";
import { authOptions } from "pages/api/auth/[...nextauth]"; import { authOptions } from "pages/api/auth/[...nextauth]";
import { HomeRedirect } from "./components"; import { HomeRedirect } from "./components";
import { PosthogClientWrapper } from "./PosthogClientWrapper";
export default async function Home() { export default async function Home() {
const session = await getServerSession(authOptions); const session = await getServerSession(authOptions);
@@ -10,9 +11,11 @@ export default async function Home() {
redirect("/auth/login"); redirect("/auth/login");
} }
return ( return (
<div> <PosthogClientWrapper>
<HomeRedirect /> <div>
<LoadingSpinner /> <HomeRedirect />
</div> <LoadingSpinner />
</div>
</PosthogClientWrapper>
); );
} }