Skip to content

Commit

Permalink
chore: fixing lint errors TETP-227
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkojamG committed Dec 17, 2024
1 parent 76e498d commit f22dc58
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,26 @@ const CookieConsent: React.FC<{ asPage?: boolean }> = ({ asPage = false }) => {
],
},
language: { onLanguageChange },
onAllConsentsGiven: (consents) => {
onAllConsentsGiven: (consents: { matomo: boolean }) => {
if (consents.matomo) {
// start tracking
// eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push
window._paq.push(['setConsentGiven']);
// eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push
window._paq.push(['setCookieConsentGiven']);
}
},
onConsentsParsed: (consents) => {
onConsentsParsed: (consents: { matomo: boolean }) => {
if (consents.matomo === undefined) {
// tell matomo to wait for consent:
// eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push
window._paq.push(['requireConsent']);
// eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push
window._paq.push(['requireCookieConsent']);
} else if (consents.matomo === false) {
// tell matomo to forget conset
if (window && window._paq) {
window._paq.push(['forgetConsentGiven']);
}
// eslint-disable-next-line no-underscore-dangle, unicorn/no-array-push-push
window._paq.push(['forgetConsentGiven']);
}
},
focusTargetSelector: '#main_content',
Expand Down
4 changes: 2 additions & 2 deletions frontend/tet/youth/src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import 'hds-design-tokens';

import init from '@socialgouv/matomo-next';
import { AppProps } from 'next/app';
import dynamic from 'next/dynamic';
import { appWithTranslation } from 'next-i18next';
import React, { useEffect } from 'react';
import { QueryClientProvider } from 'react-query';
import BaseApp from 'shared/components/app/BaseApp';
// import Footer from 'tet/youth/components/footer/Footer';
import Header from 'tet/youth/components/header/Header';
import createQueryClient from 'tet/youth/query-client/create-query-client';
import init from '@socialgouv/matomo-next';
import dynamic from 'next/dynamic';

const CookieConsent = dynamic(() => import('../components/cookieConsent/CookieConsent'), { ssr: false });
// Need to import Footer dynamically because currently HDS has issues with SSR
Expand Down
13 changes: 6 additions & 7 deletions frontend/tet/youth/src/pages/cookie-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ import { GetStaticProps, NextPage } from 'next';
import * as React from 'react';
import Container from 'shared/components/container/Container';
import getServerSideTranslations from 'shared/i18n/get-server-side-translations';

import CookieConsent from '../components/cookieConsent/CookieConsent';

const CookieSettings: NextPage = () => {
return (
<Container>
<CookieConsent asPage />
</Container>
);
};
const CookieSettings: NextPage = () => (
<Container>
<CookieConsent asPage />
</Container>
);

export const getStaticProps: GetStaticProps = getServerSideTranslations('common');

Expand Down

0 comments on commit f22dc58

Please sign in to comment.