diff --git a/src/components/Header.tsx b/src/components/Header.tsx
index 23baefd..bafe602 100644
--- a/src/components/Header.tsx
+++ b/src/components/Header.tsx
@@ -65,7 +65,6 @@ const { i18n } = declareComponentKeys<
| "operator logo alt"
| "page title surveys"
| "contact support"
- | "header"
| "content"
| "footer"
| "my surveys"
diff --git a/src/components/LegalInformation.tsx b/src/components/LegalInformation.tsx
index ed38755..7c2e017 100644
--- a/src/components/LegalInformation.tsx
+++ b/src/components/LegalInformation.tsx
@@ -22,7 +22,7 @@ export function LegalInformation() {
-
+
diff --git a/src/components/surveyHomepage/SurveyHomepage.tsx b/src/components/surveyHomepage/SurveyHomepage.tsx
index 399e5e8..6855bf3 100644
--- a/src/components/surveyHomepage/SurveyHomepage.tsx
+++ b/src/components/surveyHomepage/SurveyHomepage.tsx
@@ -244,6 +244,8 @@ const { i18n } = declareComponentKeys<
| "homepage"
| "sideMenuTitle"
| "in this section"
+ | "contact support"
+ | "FAQ"
| "legal framework"
| "what are your answers for?"
| "documents to the surveyed"
diff --git a/src/functions/getPageTitle.ts b/src/functions/getPageTitle.ts
new file mode 100644
index 0000000..e4f71b9
--- /dev/null
+++ b/src/functions/getPageTitle.ts
@@ -0,0 +1,22 @@
+export const getPageTitle = (currentPath: string) => {
+ if (currentPath.includes("/cadre-juridique")) {
+ return "legal framework";
+ }
+ if (currentPath.includes("/utilisation-reponse")) {
+ return "what are your answers for?";
+ }
+ if (currentPath.includes("/documents")) {
+ return "documents to the surveyed";
+ }
+ if (currentPath.includes("/resultats")) {
+ return "some results";
+ }
+ if (currentPath.includes("/faq")) {
+ return "FAQ";
+ }
+ if (currentPath.includes("/contacter-assistance")) {
+ return "contact support";
+ }
+
+ return "survey introduction";
+};
diff --git a/src/i18n/resources/en.tsx b/src/i18n/resources/en.tsx
index 8f84600..c45756d 100644
--- a/src/i18n/resources/en.tsx
+++ b/src/i18n/resources/en.tsx
@@ -13,7 +13,6 @@ export const translations: Translations<"en"> = {
"operator logo alt": "Insee, measure to understand",
"page title surveys": "My surveys",
"contact support": "Contact support",
- "header": "Header",
"content": "Content",
"footer": "Footer",
"my surveys": "My surveys",
@@ -34,6 +33,8 @@ export const translations: Translations<"en"> = {
"survey introduction": "Survey introduction",
"homepage": "Homepage",
"in this section": "In this section",
+ "contact support": "Contact support",
+ "FAQ": "Answer your questions",
"legal framework": "Legal framework",
"what are your answers for?": "What are your answers for?",
"documents to the surveyed": "Documents to the surveyed",
@@ -393,7 +394,7 @@ export const translations: Translations<"en"> = {
className="fr-link"
href="https://www.insee.fr/fr/information/3719162"
target="_blank"
- title="https://www.insee.fr/fr/information/3719162 - open link in a new tab"
+ title="Personal Data - open a new window"
>
Personal Data
{" "}
@@ -402,7 +403,7 @@ export const translations: Translations<"en"> = {
className="fr-link"
href="https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX%3A32016R0679"
target="_blank"
- title="https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=CELEX%3A32016R0679 - open link in a new tab"
+ title="General Data Protection Regulation - open a new window"
>
General Data Protection Regulation (GDPR)
{" "}
@@ -411,7 +412,7 @@ export const translations: Translations<"en"> = {
className="fr-link"
href="https://www.legifrance.gouv.fr/loda/id/JORFTEXT000000886460"
target="_blank"
- title="https://www.legifrance.gouv.fr/loda/id/JORFTEXT000000886460 - open link in a new tab"
+ title="French Data Protection Act - open a new window"
>
French Data Protection Act
diff --git a/src/i18n/resources/fr.tsx b/src/i18n/resources/fr.tsx
index bd55c25..3cf068e 100644
--- a/src/i18n/resources/fr.tsx
+++ b/src/i18n/resources/fr.tsx
@@ -13,7 +13,6 @@ export const translations: Translations<"fr"> = {
"operator logo alt": "Insee, mesurer pour comprendre",
"page title surveys": "Mes enquêtes",
"contact support": "Contacter l'assistance",
- "header": "Menu",
"content": "Contenu",
"footer": "Pied de page",
"my surveys": "Mes enquêtes",
@@ -33,6 +32,8 @@ export const translations: Translations<"fr"> = {
"survey introduction": "Introduction à l'enquête",
"homepage": "Accueil",
"in this section": "Dans cette rubrique",
+ "contact support": "Contacter l'assistance",
+ "FAQ": "Réponses à vos questions",
"legal framework": "Cadre juridique",
"what are your answers for?": "À quoi servent vos réponses ?",
"documents to the surveyed": "Documents aux enquêtés",
@@ -394,7 +395,7 @@ export const translations: Translations<"fr"> = {
className="fr-link"
href="https://www.insee.fr/fr/information/3719162"
target="_blank"
- title="https://www.insee.fr/fr/information/3719162 - ouvrir dans un nouvel onglet"
+ title="Données à caractère personnel - ouvre une nouvelle fenêtre"
>
Données à caractère personnel
{" "}
@@ -403,7 +404,7 @@ export const translations: Translations<"fr"> = {
className="fr-link"
href="https://eur-lex.europa.eu/legal-content/FR/TXT/?uri=CELEX%3A32016R0679"
target="_blank"
- title="https://eur-lex.europa.eu/legal-content/FR/TXT/?uri=CELEX%3A32016R0679- ouvrir dans un nouvel onglet"
+ title="Règlement général sur la protection des données- ouvre une nouvelle fenêtre"
>
Règlement général sur la protection des données (RGPD)
{" "}
@@ -412,7 +413,7 @@ export const translations: Translations<"fr"> = {
className="fr-link"
href="https://www.legifrance.gouv.fr/loda/id/JORFTEXT000000886460"
target="_blank"
- title="https://www.legifrance.gouv.fr/loda/id/JORFTEXT000000886460 - ouvrir dans un nouvel onglet"
+ title="loi Informatique et Libertés - ouvre une nouvelle fenêtre"
>
loi Informatique et Libertés
diff --git a/src/routes/$survey.tsx b/src/routes/$survey.tsx
index 475c92e..bb0db17 100644
--- a/src/routes/$survey.tsx
+++ b/src/routes/$survey.tsx
@@ -4,6 +4,7 @@ import { SurveyHomepage } from "components/surveyHomepage/SurveyHomepage";
import { useTranslation } from "i18n";
import { Helmet } from "react-helmet-async";
import content from "resources/content.json";
+import { getPageTitle } from "functions/getPageTitle";
export const Route = createFileRoute("/$survey")({
component: Index,
@@ -11,6 +12,7 @@ export const Route = createFileRoute("/$survey")({
function Index() {
const { t: headerTranslation } = useTranslation("Header");
+ const { t } = useTranslation("SurveyHomepage");
const { survey } = Route.useParams();
const surveyData = content.specifique.find(s => s.id === survey);
const router = useRouter();
@@ -30,10 +32,12 @@ function Index() {
if (hasNotSideMenu) {
return
;
}
+
+ const sectionTitle = getPageTitle(currentPath);
return (
- {`${surveyData?.titleShort} - ${headerTranslation("service tagline")}`}
+ {`${t(sectionTitle)} - ${surveyData?.titleShort} - ${headerTranslation("service tagline")}`}
diff --git a/src/routes/__root.tsx b/src/routes/__root.tsx
index 047033a..d89431f 100644
--- a/src/routes/__root.tsx
+++ b/src/routes/__root.tsx
@@ -1,4 +1,9 @@
-import { createRootRouteWithContext, Outlet, ScrollRestoration } from "@tanstack/react-router";
+import {
+ createRootRouteWithContext,
+ Outlet,
+ ScrollRestoration,
+ useRouter,
+} from "@tanstack/react-router";
import { Footer } from "components/Footer";
import { Header } from "components/Header";
import { QueryClient } from "@tanstack/react-query";
@@ -6,6 +11,7 @@ import { AutoLogoutCountdown } from "components/AutoLogoutCountdown";
import { SkipLinks } from "@codegouvfr/react-dsfr/SkipLinks";
import { useTranslation } from "i18n";
import { NotFound } from "components/errorPages/NotFound";
+import { useEffect, useRef } from "react";
export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()({
component: RootComponent,
@@ -15,18 +21,24 @@ export const Route = createRootRouteWithContext<{ queryClient: QueryClient }>()(
function RootComponent() {
const { t } = useTranslation("Header");
+ const router = useRouter();
+
+ const currentPath = router.history.location.pathname;
+
+ const ref = useRef
(null);
+
+ useEffect(() => {
+ ref.current?.focus();
+ }, [currentPath]);
+
return (
-