Quiz-PDF/Frontend/app/layout.tsx

114 lines
3.4 KiB
TypeScript

/* eslint-disable @next/next/no-before-interactive-script-outside-document */
import "./globals.css";
import "../app/globals.css";
import { Arimo, Indie_Flower } from "next/font/google";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import Header from "@/components/Header";
import { cookies } from "next/headers";
import { isAuthenticated } from "@/lib/auth";
import { GTagProvider, PHProvider, ThemeProvider } from "./providers";
import Script from "next/script";
const raleway = Arimo({
variable: "--body-font",
subsets: ["latin"],
display: "swap",
});
const arimo = Arimo({
variable: "--body-font",
subsets: ["latin"],
display: "swap",
});
const indieFlower = Indie_Flower({
variable: "--accent-font",
weight: "400",
subsets: ["latin"],
display: "swap",
});
export default async function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
const isUserLoggedIn = await isAuthenticated(cookies());
return (
<html
lang="en"
className={`h-full ${raleway.variable} ${arimo.variable} ${indieFlower.variable}`}
suppressHydrationWarning
>
<PHProvider>
<GTagProvider />
<body className={`${arimo.className} bg-base-100 flex`}>
<ThemeProvider>
<Header isUserLoggedIn={isUserLoggedIn} authString={cookies().get("pb_auth")?.value || ""} />
{children}
<ToastContainer
position="bottom-left"
autoClose={5000}
hideProgressBar={false}
newestOnTop={false}
closeOnClick
rtl={false}
pauseOnFocusLoss
draggable
pauseOnHover
theme="colored"
/>
</ThemeProvider>
{/* <Link
rel="preload"
href={"/images/fastpocket-diagram_352x316.webp"}
as={"image"}
type="image/webp"
prefetch={true}/> */}
<Script
id="promotekit-jq"
src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"
strategy="beforeInteractive"
/>
<Script
id="promotekit-js"
async
defer
strategy="afterInteractive"
src="https://cdn.promotekit.com/promotekit.js"
data-promotekit="41c8e339-d2aa-414b-88b8-31b6d6346e2b"
/>
<Script
id="promotekit"
async
defer
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `
$(document).ready(function(){
setTimeout(function() {
$('a[href^="https://buy.stripe.com/"]').each(function(){
const oldBuyUrl = $(this).attr("href");
const referralId = window.promotekit_referral;
if (!oldBuyUrl.includes("client_reference_id")) {
const newBuyUrl = oldBuyUrl + "?client_reference_id=" + referralId;
$(this).attr("href", newBuyUrl);
}
});
$("[pricing-table-id]").each(function(){
$(this).attr("client-reference-id", window.promotekit_referral);
});
}, 2000);
});
`,
}}
></Script>
</body>
</PHProvider>
</html>
);
}