From cd2cb5748be9e9c479d9802dd3897de1cd1cbd9f Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Sat, 9 Dec 2023 18:13:46 +0100
Subject: refactor(pages): refine LegalNotice page

* remove unnecessary dependency (useRouter)
* fix React errors (blurWidth/blurHeight)
* complete Cypress tests
---
 src/pages/mentions-legales.tsx | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

(limited to 'src/pages/mentions-legales.tsx')

diff --git a/src/pages/mentions-legales.tsx b/src/pages/mentions-legales.tsx
index 7d46680..176c8fe 100644
--- a/src/pages/mentions-legales.tsx
+++ b/src/pages/mentions-legales.tsx
@@ -1,7 +1,5 @@
-/* eslint-disable max-statements */
 import type { GetStaticProps } from 'next';
 import Head from 'next/head';
-import { useRouter } from 'next/router';
 import Script from 'next/script';
 import { useIntl } from 'react-intl';
 import {
@@ -36,13 +34,12 @@ const LegalNoticePage: NextPageWithLayout = () => {
     title,
     url: ROUTES.LEGAL_NOTICE,
   });
-
   const { ref, tree } = useHeadingsTree<HTMLDivElement>({ fromLevel: 2 });
-  const { asPath } = useRouter();
+
   const webpageSchema = getWebPageSchema({
     description: seo.description,
     locale: CONFIG.locales.defaultLocale,
-    slug: asPath,
+    slug: ROUTES.LEGAL_NOTICE,
     title: seo.title,
     updateDate: dates.update,
   });
@@ -52,13 +49,14 @@ const LegalNoticePage: NextPageWithLayout = () => {
     id: 'legal-notice',
     kind: 'page',
     locale: CONFIG.locales.defaultLocale,
-    slug: asPath,
+    slug: ROUTES.LEGAL_NOTICE,
     title,
   });
   const schemaJsonLd = getSchemaJson([webpageSchema, articleSchema]);
+
   const page = {
     title: `${seo.title} - ${CONFIG.name}`,
-    url: `${CONFIG.url}${asPath}`,
+    url: `${CONFIG.url}${ROUTES.LEGAL_NOTICE}`,
   };
   const tocTitle = intl.formatMessage({
     defaultMessage: 'Table of Contents',
@@ -100,7 +98,7 @@ const LegalNoticePage: NextPageWithLayout = () => {
       />
       <PageSidebar>
         <TocWidget
-          heading={<Heading level={3}>{tocTitle}</Heading>}
+          heading={<Heading level={2}>{tocTitle}</Heading>}
           tree={tree}
         />
       </PageSidebar>
-- 
cgit v1.2.3

