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

View File

@@ -1,6 +1,7 @@
import { Logo } from "@/components/Logo";
import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import { PosthogClientWrapper } from "../PosthogClientWrapper";
export default async function AuthLayout({ children }: { children: React.ReactNode }) {
const session = await getServerSession();
@@ -8,19 +9,21 @@ export default async function AuthLayout({ children }: { children: React.ReactNo
redirect(`/`);
}
return (
<div className="min-h-screen bg-slate-50">
<div className="isolate bg-white">
<div className="bg-gradient-radial flex min-h-screen from-slate-200 to-slate-50">
<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="mx-auto w-full max-w-sm rounded-xl bg-white p-8 shadow-xl lg:w-96">
<div className="mb-8 text-center">
<Logo className="mx-auto w-3/4" />
<PosthogClientWrapper>
<div className="min-h-screen bg-slate-50">
<div className="isolate bg-white">
<div className="bg-gradient-radial flex min-h-screen from-slate-200 to-slate-50">
<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="mx-auto w-full max-w-sm rounded-xl bg-white p-8 shadow-xl lg:w-96">
<div className="mb-8 text-center">
<Logo className="mx-auto w-3/4" />
</div>
{children}
</div>
{children}
</div>
</div>
</div>
</div>
</div>
</PosthogClientWrapper>
);
}

View File

@@ -0,0 +1,5 @@
import { PosthogClientWrapper } from "../PosthogClientWrapper";
export default async function AuthLayout({ children }: { children: React.ReactNode }) {
return <PosthogClientWrapper>{children}</PosthogClientWrapper>;
}

View File

@@ -5,6 +5,7 @@ import { redirect } from "next/navigation";
import { authOptions } from "pages/api/auth/[...nextauth]";
import PosthogIdentify from "./PosthogIdentify";
import FormbricksClient from "./FormbricksClient";
import { PosthogClientWrapper } from "../../PosthogClientWrapper";
export default async function EnvironmentLayout({ children, params }) {
const session = await getServerSession(authOptions);
@@ -18,10 +19,12 @@ export default async function EnvironmentLayout({ children, params }) {
<FormbricksClient session={session} />
<ToasterClient />
<EnvironmentsNavbar environmentId={params.environmentId} session={session} />
<main className="h-full flex-1 overflow-y-auto bg-slate-50">
{children}
<main />
</main>
<PosthogClientWrapper>
<main className="h-full flex-1 overflow-y-auto bg-slate-50">
{children}
<main />
</main>
</PosthogClientWrapper>
</>
);
}

View File

@@ -0,0 +1,5 @@
import { PosthogClientWrapper } from "../PosthogClientWrapper";
export default async function AuthLayout({ children }: { children: React.ReactNode }) {
return <PosthogClientWrapper>{children}</PosthogClientWrapper>;
}

View File

@@ -1,4 +1,3 @@
import { PosthogClientWrapper } from "@/app/PosthogClientWrapper";
import "./globals.css";
export const metadata = {
@@ -9,9 +8,7 @@ export const metadata = {
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body className="flex h-screen flex-col bg-slate-50">
<PosthogClientWrapper>{children}</PosthogClientWrapper>
</body>
<body className="flex h-screen flex-col bg-slate-50">{children}</body>
</html>
);
}

View File

@@ -3,6 +3,7 @@ import { getServerSession } from "next-auth";
import { redirect } from "next/navigation";
import { authOptions } from "pages/api/auth/[...nextauth]";
import { HomeRedirect } from "./components";
import { PosthogClientWrapper } from "./PosthogClientWrapper";
export default async function Home() {
const session = await getServerSession(authOptions);
@@ -10,9 +11,11 @@ export default async function Home() {
redirect("/auth/login");
}
return (
<div>
<HomeRedirect />
<LoadingSpinner />
</div>
<PosthogClientWrapper>
<div>
<HomeRedirect />
<LoadingSpinner />
</div>
</PosthogClientWrapper>
);
}