Skip to content

Commit

Permalink
add consents
Browse files Browse the repository at this point in the history
  • Loading branch information
Jame committed Dec 21, 2023
1 parent 9ab7413 commit 36d9a1a
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 1 deletion.
6 changes: 6 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import '@wevisdemo/ui/styles/typography.css';
import '../styles/globals.scss';
import NavbarApp from '@/components/NavbarApp';
import Providers from '@/components/Providers';
import PlausibleProvider from 'next-plausible';
import Consent from '@/components/Consent';

export const metadata: Metadata = {
title:
Expand All @@ -19,11 +21,15 @@ export default function RootLayout({
}) {
return (
<html lang="en" className="wv-ibmplex overflow-x-clip text-center">
<head>
<PlausibleProvider domain="wevis.info/con-court" />
</head>
<body id="intro" className="overflow-x-clip">
<Providers>
<NavbarApp />
{children}
</Providers>
<Consent />
</body>
</html>
);
Expand Down
21 changes: 21 additions & 0 deletions components/Consent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use client';

import '@wevisdemo/ui/styles/cookie-consent.css';
import { initMsClarity } from '@/utils/msClarity';
import WvCookieConsent from '@wevisdemo/ui/react/cookie-consent';

export default function Consent() {
const cookieOptions = ['Functionality', 'Performance', 'Advertising'];

const onCookieAccept = (option: any) => {
if (option.Performance) initMsClarity();
};

return (
<WvCookieConsent
policyUrl="https://wevis.info/cookies_1-3/"
cookieOptions={cookieOptions}
onAccept={onCookieAccept}
/>
);
}
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"lodash": "^4.17.21",
"lottie-react": "^2.4.0",
"next": "14.0.0",
"next-plausible": "^3.12.0",
"react": "^18",
"react-dom": "^18",
"sass": "^1.69.5",
Expand Down
8 changes: 7 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx",
"**/*.js",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}
14 changes: 14 additions & 0 deletions utils/msClarity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export const initMsClarity = () => {
(function (c, l, a, r, i, t, y) {
c[a] =
c[a] ||
function () {
(c[a].q = c[a].q || []).push(arguments);
};
t = l.createElement(r);
t.async = 1;
t.src = 'https://www.clarity.ms/tag/' + i;
y = l.getElementsByTagName(r)[0];
y.parentNode.insertBefore(t, y);
})(window, document, 'clarity', 'script', 'k9a6azq09m');
};

0 comments on commit 36d9a1a

Please sign in to comment.