From 2625054a00ed320bdd45fd484c35933f5efe6697 Mon Sep 17 00:00:00 2001 From: f1lander Date: Fri, 1 Dec 2023 14:07:34 -0600 Subject: [PATCH] removes cookies banner from blocked page --- pages/_app.tsx | 24 +++++++++++++++++++++++- pages/_document.tsx | 9 +-------- pages/blocked.tsx | 6 +++--- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/pages/_app.tsx b/pages/_app.tsx index bd7ab15..e5aaf2d 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,12 +1,14 @@ import { globalCss } from "@obolnetwork/obol-ui"; import type { AppProps } from "next/app"; import TopLeftBg from "../public/backgrounds/top-left-bg.svg"; +import { useEffect } from "react"; +import { useRouter } from "next/router"; const globalStyles = globalCss({ html: { overflowX: "hidden", }, - body: { + body: { background: `url(${TopLeftBg.src}) left top no-repeat`, backgroundColor: "$bg01", padding: 0, @@ -21,6 +23,26 @@ const globalStyles = globalCss({ function MyApp({ Component, pageProps }: AppProps) { globalStyles(); + const router = useRouter(); + + useEffect(() => { + // Check if the current page is not the blocked page + if (router.pathname !== "/blocked") { + // Dynamically load the cookie banner script + const script = document.createElement("script"); + script.src = "https://app.termly.io/embed.min.js"; + script.type = "text/javascript"; + script.async = true; + script.setAttribute("data-auto-block", "on"); + script.setAttribute( + "data-website-uuid", + "01eadf2f-d1f3-4db1-bdce-a3cb1cd9f4d7" + ); + + document.body.appendChild(script); + } + }, [router.pathname]); // Only re-run the effect if the pathname changes + return ; } diff --git a/pages/_document.tsx b/pages/_document.tsx index db97fe9..b457092 100644 --- a/pages/_document.tsx +++ b/pages/_document.tsx @@ -14,7 +14,7 @@ export default class Document extends NextDocument { return ( -