From cc7d0bfc7c52f50dc8bc20a634fb0b2d278e1b78 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 28 Jan 2023 13:10:40 +0200 Subject: [PATCH] Playwire test --- app/components/layout/Footer.tsx | 38 +++++++- app/features/info/routes/privacy-policy.tsx | 21 ++++ app/root.tsx | 103 ++++++++++++++++++++ app/routes/test.tsx | 91 +++++++++++++++++ app/styles/common.css | 12 +++ remix.config.js | 1 + 6 files changed, 265 insertions(+), 1 deletion(-) create mode 100644 app/features/info/routes/privacy-policy.tsx create mode 100644 app/routes/test.tsx diff --git a/app/components/layout/Footer.tsx b/app/components/layout/Footer.tsx index b8d4f2dbe..51bffb265 100644 --- a/app/components/layout/Footer.tsx +++ b/app/components/layout/Footer.tsx @@ -1,4 +1,4 @@ -import { Link } from "@remix-run/react"; +import { Link, useLocation } from "@remix-run/react"; import { useTranslation } from "~/hooks/useTranslation"; import type { RootLoaderData } from "~/root"; import { discordFullName } from "~/utils/strings"; @@ -96,6 +96,7 @@ export function Footer({ ) : null} +
sendou.ink © Copyright of Sendou and contributors 2019-{currentYear}. Original content & source code is licensed under the GPL-3.0 license. @@ -105,3 +106,38 @@ export function Footer({ ); } + +function PlaywireBadge() { + const location = useLocation(); + + if (location.pathname !== "/test") return null; + + return ( +
+

+ {/* eslint-disable-next-line react/jsx-no-target-blank */} + + Playwire + Playwire + +

+

+ + Advertise on this site + +

+
+ ); +} diff --git a/app/features/info/routes/privacy-policy.tsx b/app/features/info/routes/privacy-policy.tsx new file mode 100644 index 000000000..7d889be9d --- /dev/null +++ b/app/features/info/routes/privacy-policy.tsx @@ -0,0 +1,21 @@ +import type { MetaFunction } from "@remix-run/node"; +import { Main } from "~/components/Main"; +import { makeTitle } from "~/utils/strings"; + +export const meta: MetaFunction = () => { + return { + title: makeTitle("Privacy Policy"), + }; +}; + +export default function PrivacyPolicyPage() { + return ( +
+
let optOutCounter = 0; function setCookie(cname,cvalue,exdays){var d = new Date();d.setTime(d.getTime()+(exdays*24*60*60*1000));var expires='expires='+d.toUTCString();document.cookie=cname+'='+cvalue+';'+expires+';path=/'; if(optOutCounter==0){ let cookieP = document.getElementById('cookieP'); var successCookie = document.createElement('h3'); successCookie.innerHTML = 'Optout Success!'; successCookie.setAttribute('style','color:green'); cookieP.appendChild(successCookie); optOutCounter ++ } };

Common ID Cookie

This site uses cookies and similar tracking technologies such as the Common ID cookie to provide its services. Cookies are important devices for measuring advertising effectiveness and ensuring a robust online advertising industry. The Common ID cookie stores a unique user id in the first party domain and is accessible to our ad partners. This simple ID that can be utilized to improve user matching, especially for delivering ads to iOS and MacOS browsers. Users can opt out of the Common ID tracking cookie by clicking here.

Advertising Privacy Settings

FOR EU USERS ONLY: When you use our site, pre-selected companies may access and use certain information on your device and about your interests to serve ads or personalized content. You may revisit or change consent-choices at any time by clicking here.

`, + }} + /> +
+ ); +} diff --git a/app/root.tsx b/app/root.tsx index 6b39c7401..56ecf2021 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -14,6 +14,7 @@ import { type ShouldRevalidateFunction, useLoaderData, useMatches, + useLocation, } from "@remix-run/react"; import * as React from "react"; import commonStyles from "~/styles/common.css"; @@ -88,6 +89,9 @@ export interface RootLoaderData { | "discordName" | "patronTier" >; + gtagId?: string; + publisherId?: string; + websiteId?: string; } export const loader: LoaderFunction = async ({ request }) => { @@ -103,6 +107,9 @@ export const loader: LoaderFunction = async ({ request }) => { theme: themeSession.getTheme(), patrons: db.users.findAllPatrons(), baseUrl: process.env["BASE_URL"], + gtagId: process.env["GTAG_ID"], + publisherId: process.env["PLAYWIRE_PUBLISHER_ID"], + websiteId: process.env["PLAYWIRE_WEBSITE_ID"], user: user ? { discordName: user.discordName, @@ -151,6 +158,7 @@ function Document({ + {process.env.NODE_ENV === "development" && } @@ -273,6 +281,101 @@ function Fonts() { ); } +function PlaywireScripts() { + const location = useLocation(); + const data = useLoaderData(); + + if ( + !data || + !data.gtagId || + !data.publisherId || + !data.websiteId || + location.pathname !== "/test" + ) { + return null; + } + + const units: Array<{ selectorId?: string; type: string }> = [ + { + selectorId: "top-leaderboard", + type: "leaderboard_atf", + }, + { + type: "bottom_rail", + }, + ]; + + return ( + <> + {/* Step 1. */} +