diff --git a/frontend/packages/akr/public/i18n/en-GB/common.json b/frontend/packages/akr/public/i18n/en-GB/common.json index ebe487975..b35017d19 100644 --- a/frontend/packages/akr/public/i18n/en-GB/common.json +++ b/frontend/packages/akr/public/i18n/en-GB/common.json @@ -4,7 +4,7 @@ "acceptTerms": "Accept conditions", "akrLogoAlt": "Logo: Authorised translator’s examination system.", "appNameAbbreviation": "AKR", - "appTitle": "Register of authorised translators | Finnish National Agency for Education", + "appTitle": "Register of authorised translators - Finnish National Agency for Education", "back": "Back", "backToHomePage": "Back to front page", "cancel": "Cancel", @@ -31,7 +31,14 @@ "requiredFieldsInfo": "Fields marked with a star (*) are mandatory.", "save": "Save", "send": "Send", - "yes": "Yes" + "yes": "Yes", + "pageTitle": { + "frontPage": "Front page", + "notFound": "Page not found", + "clerkHomepage": "Administrator", + "accessibilityStatement": "Accessibility statement", + "privacyPolicy": "Privacy policy statement" + } } } } diff --git a/frontend/packages/akr/public/i18n/fi-FI/common.json b/frontend/packages/akr/public/i18n/fi-FI/common.json index 2d1dfa66a..932414679 100644 --- a/frontend/packages/akr/public/i18n/fi-FI/common.json +++ b/frontend/packages/akr/public/i18n/fi-FI/common.json @@ -4,7 +4,7 @@ "acceptTerms": "Hyväksy ehdot", "akrLogoAlt": "Logo: Auktorisoidun kääntäjän tutkintojärjestelmä.", "appNameAbbreviation": "AKR", - "appTitle": "Auktorisoitujen kääntäjien rekisteri | Opetushallitus", + "appTitle": "Auktorisoitujen kääntäjien rekisteri - Opetushallitus", "back": "Takaisin", "backToHomePage": "Takaisin etusivulle", "cancel": "Peruuta", @@ -32,7 +32,14 @@ "save": "Tallenna", "send": "Lähetä", "statistics": "Tilastot", - "yes": "Kyllä" + "yes": "Kyllä", + "pageTitle": { + "frontPage": "Etusivu", + "notFound": "Etsimääsi sivua ei löytynyt", + "clerkHomepage": "Virkailija", + "accessibilityStatement": "Saavutettavuusseloste", + "privacyPolicy": "Tietosuojaseloste" + } } } } diff --git a/frontend/packages/akr/public/i18n/sv-SE/common.json b/frontend/packages/akr/public/i18n/sv-SE/common.json index 017fa478f..ef3ac4a55 100644 --- a/frontend/packages/akr/public/i18n/sv-SE/common.json +++ b/frontend/packages/akr/public/i18n/sv-SE/common.json @@ -4,7 +4,7 @@ "acceptTerms": "Acceptera villkoren", "akrLogoAlt": "Logo: Examenssystemet för auktoriserade translatorer.", "appNameAbbreviation": "AKR", - "appTitle": "Register över auktoriserade translatorer | Utbildningsstyrelsen", + "appTitle": "Register över auktoriserade translatorer - Utbildningsstyrelsen", "back": "Tillbaka", "backToHomePage": "Tillbaka till framsidan", "cancel": "Avbryt", @@ -31,7 +31,14 @@ "requiredFieldsInfo": "Fält markerade med en stjärna (*) är obligatoriska.", "save": "Spara", "send": "Sänd", - "yes": "Ja" + "yes": "Ja", + "pageTitle": { + "frontPage": "Framsida", + "notFound": "Sidan hittades inte", + "clerkHomepage": "Administratör", + "accessibilityStatement": "Tillgänglighetsutlåtande", + "privacyPolicy": "Dataskyddsbeskrivning" + } } } } diff --git a/frontend/packages/akr/src/routers/AppRouter.tsx b/frontend/packages/akr/src/routers/AppRouter.tsx index 8fe87d9b1..2f5b2cddb 100644 --- a/frontend/packages/akr/src/routers/AppRouter.tsx +++ b/frontend/packages/akr/src/routers/AppRouter.tsx @@ -1,4 +1,4 @@ -import { FC, useEffect } from 'react'; +import { FC } from 'react'; import { createBrowserRouter, createRoutesFromElements, @@ -11,6 +11,7 @@ import { NotifierContextProvider, ScrollToTop, } from 'shared/components'; +import { TitlePage } from 'shared/utils'; import { Footer } from 'components/layouts/Footer'; import { Header } from 'components/layouts/Header'; @@ -32,6 +33,7 @@ import { StatisticsPage } from 'pages/StatisticsPage'; export const AppRouter: FC = () => { const translateCommon = useCommonTranslation(); + const appTitle = translateCommon('appTitle'); const ErrorToast = () => { useAPIErrorToast(); @@ -39,6 +41,9 @@ export const AppRouter: FC = () => { return <>; }; + const createTitle = (title: string) => + translateCommon('pageTitle.' + title) + ' - ' + appTitle; + const Root = (
@@ -56,49 +61,105 @@ export const AppRouter: FC = () => {
); - useEffect(() => { - document.title = translateCommon('appTitle'); - }, [translateCommon]); + const FrontPage = ( + + + + ); const router = createBrowserRouter( createRoutesFromElements( - } /> - } /> + + + + + + } + /> } + element={ + + + + } /> } + element={ + + + + } + /> + + + + } /> - } /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } + /> + + + + } /> - } /> , ), ); diff --git a/frontend/packages/otr/public/i18n/en-GB/common.json b/frontend/packages/otr/public/i18n/en-GB/common.json index bc470926d..a31447042 100644 --- a/frontend/packages/otr/public/i18n/en-GB/common.json +++ b/frontend/packages/otr/public/i18n/en-GB/common.json @@ -3,7 +3,7 @@ "common": { "allRegions": "Whole Finland", "appNameAbbreviation": "OTR", - "appTitle": "Register of legal interpreters | Finnish National Agency for Education", + "appTitle": "Register of legal interpreters - Finnish National Agency for Education", "back": "Back", "backToHomePage": "Back to front page", "cancel": "Cancel", @@ -31,7 +31,14 @@ "rowsPerPageLabel": "Results per page", "save": "Save", "searchResults": "Search results", - "yes": "Yes" + "yes": "Yes", + "pageTitle": { + "frontPage": "Front page", + "notFound": "Page not found", + "clerkHomepage": "Administrator", + "accessibilityStatement": "Accessibility statement", + "privacyPolicy": "Privacy policy statement" + } } } } diff --git a/frontend/packages/otr/public/i18n/fi-FI/common.json b/frontend/packages/otr/public/i18n/fi-FI/common.json index 8fe4c0cc8..732fc2366 100644 --- a/frontend/packages/otr/public/i18n/fi-FI/common.json +++ b/frontend/packages/otr/public/i18n/fi-FI/common.json @@ -3,7 +3,7 @@ "common": { "allRegions": "Koko Suomi", "appNameAbbreviation": "OTR", - "appTitle": "Oikeustulkkirekisteri | Opetushallitus", + "appTitle": "Oikeustulkkirekisteri - Opetushallitus", "back": "Takaisin", "backToHomePage": "Takaisin etusivulle", "cancel": "Peruuta", @@ -31,7 +31,14 @@ "rowsPerPageLabel": "Tulokset per sivu", "save": "Tallenna", "searchResults": "Hakutulokset", - "yes": "Kyllä" + "yes": "Kyllä", + "pageTitle": { + "frontPage": "Etusivu", + "notFound": "Etsimääsi sivua ei löytynyt", + "clerkHomepage": "Virkailija", + "accessibilityStatement": "Saavutettavuusseloste", + "privacyPolicy": "Tietosuojaseloste" + } } } } diff --git a/frontend/packages/otr/public/i18n/sv-SE/common.json b/frontend/packages/otr/public/i18n/sv-SE/common.json index 0ec902675..b64fd89e7 100644 --- a/frontend/packages/otr/public/i18n/sv-SE/common.json +++ b/frontend/packages/otr/public/i18n/sv-SE/common.json @@ -3,7 +3,7 @@ "common": { "allRegions": "Hela Finland", "appNameAbbreviation": "OTR", - "appTitle": "Registret över rättstolkar | Utbildningsstyrelsen", + "appTitle": "Registret över rättstolkar - Utbildningsstyrelsen", "back": "Tillbaka", "backToHomePage": "Tillbaka till framsidan", "cancel": "Avbryt", @@ -31,7 +31,14 @@ "rowsPerPageLabel": "Resultat per sida", "save": "Spara", "searchResults": "Sökresultat", - "yes": "Ja" + "yes": "Ja", + "pageTitle": { + "frontPage": "Framsida", + "notFound": "Sidan hittades inte", + "clerkHomepage": "Administratör", + "accessibilityStatement": "Tillgänglighetsutlåtande", + "privacyPolicy": "Dataskyddsbeskrivning" + } } } } diff --git a/frontend/packages/otr/src/routers/AppRouter.tsx b/frontend/packages/otr/src/routers/AppRouter.tsx index c8dd623d1..5f0aab51e 100644 --- a/frontend/packages/otr/src/routers/AppRouter.tsx +++ b/frontend/packages/otr/src/routers/AppRouter.tsx @@ -1,4 +1,4 @@ -import { FC, useEffect } from 'react'; +import { FC } from 'react'; import { createBrowserRouter, createRoutesFromElements, @@ -11,6 +11,7 @@ import { NotifierContextProvider, ScrollToTop, } from 'shared/components'; +import { TitlePage } from 'shared/utils'; import { Footer } from 'components/layouts/Footer'; import { Header } from 'components/layouts/Header'; @@ -29,6 +30,10 @@ import { PublicHomePage } from 'pages/PublicHomePage'; export const AppRouter: FC = () => { const translateCommon = useCommonTranslation(); + const appTitle = translateCommon('appTitle'); + + const createTitle = (title: string) => + translateCommon('pageTitle.' + title) + ' - ' + appTitle; const ErrorToast = () => { useAPIErrorToast(); @@ -53,40 +58,81 @@ export const AppRouter: FC = () => { ); - useEffect(() => { - document.title = translateCommon('appTitle'); - }, [translateCommon]); + const FrontPage = ( + + + + ); const router = createBrowserRouter( createRoutesFromElements( - } /> - } /> + + + + + + } + /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } /> } + element={ + + + + } + /> + + + + } /> - } /> , ), ); diff --git a/frontend/packages/otr/src/tests/cypress/support/page-objects/publicHomePage.ts b/frontend/packages/otr/src/tests/cypress/support/page-objects/publicHomePage.ts index 0db8aca75..3337274be 100644 --- a/frontend/packages/otr/src/tests/cypress/support/page-objects/publicHomePage.ts +++ b/frontend/packages/otr/src/tests/cypress/support/page-objects/publicHomePage.ts @@ -2,7 +2,7 @@ import { selectComboBoxOptionByName } from 'tests/cypress/support/utils/comboBox class PublicHomePage { elements = { - nameFilter: () => cy.findByRole('searchbox', { name: "Nimi" }), + nameFilter: () => cy.findByRole('searchbox', { name: 'Nimi' }), regionFilter: () => cy.findByTestId('public-interpreter-filters__region-combobox'), searchButton: () => diff --git a/frontend/packages/vkt/src/routers/AppRouter.tsx b/frontend/packages/vkt/src/routers/AppRouter.tsx index 63ea27339..fda7757a6 100644 --- a/frontend/packages/vkt/src/routers/AppRouter.tsx +++ b/frontend/packages/vkt/src/routers/AppRouter.tsx @@ -72,6 +72,7 @@ export const AppRouter: FC = () => { const router = createBrowserRouter( createRoutesFromElements( + { beforeEach(() => { diff --git a/frontend/packages/yki/src/routers/AppRouter.tsx b/frontend/packages/yki/src/routers/AppRouter.tsx index 89fb1139c..e4d2c1e1a 100644 --- a/frontend/packages/yki/src/routers/AppRouter.tsx +++ b/frontend/packages/yki/src/routers/AppRouter.tsx @@ -71,17 +71,17 @@ export const AppRouter: FC = () => { ); + const FrontPage = ( + + + + ); + const router = createBrowserRouter( createRoutesFromElements( - - - - } - /> + + { cy.wait('@initRegistration'); onExamDetailsPage.isVisible(); - const { first_name, last_name, street_address, zip, post_office, ssn } = expectedSuomiFiRegistrationDetails; + const { first_name, last_name, street_address, zip, post_office, ssn } = + expectedSuomiFiRegistrationDetails; onExamDetailsPage.fillFieldByLabel('Etunimet *', first_name); onExamDetailsPage.fillFieldByLabel('Sukunimi *', last_name); diff --git a/frontend/packages/yki/src/tests/msw/handlers.ts b/frontend/packages/yki/src/tests/msw/handlers.ts index f6d02ec4d..a2df6ff0c 100644 --- a/frontend/packages/yki/src/tests/msw/handlers.ts +++ b/frontend/packages/yki/src/tests/msw/handlers.ts @@ -11,12 +11,12 @@ const notFound = () => new HttpResponse(null, { status: 404 }); export const handlers = [ http.get(APIEndpoints.Evaluations, () => - HttpResponse.json(evaluationPeriods) + HttpResponse.json(evaluationPeriods), ), http.get(APIEndpoints.Evaluation, ({ params }) => { const { evaluationId } = params; const evaluationPeriod = evaluationPeriods.evaluation_periods.filter( - (ep) => ep.id === Number(evaluationId) + (ep) => ep.id === Number(evaluationId), )[0]; if (evaluationPeriod) { return HttpResponse.json(evaluationPeriod); @@ -26,12 +26,12 @@ export const handlers = [ }), http.get( APIEndpoints.ExamSessions, - () => new Response(JSON.stringify(examSessions), { status: 200 }) + () => new Response(JSON.stringify(examSessions), { status: 200 }), ), http.get(APIEndpoints.ExamSession, ({ params }) => { const { examSessionId } = params; const examSession = examSessions.exam_sessions.find( - (es) => es.id === Number(examSessionId) + (es) => es.id === Number(examSessionId), ); if (examSession) { return HttpResponse.json(examSession); @@ -40,15 +40,15 @@ export const handlers = [ } }), http.get(APIEndpoints.User, () => - HttpResponse.json(SuomiFiAuthenticatedSessionResponse) + HttpResponse.json(SuomiFiAuthenticatedSessionResponse), ), http.post(APIEndpoints.EvaluationOrder, () => - HttpResponse.json(evaluationOrderPostResponse) + HttpResponse.json(evaluationOrderPostResponse), ), http.get(APIEndpoints.CountryCodes, () => - HttpResponse.json(maatJaValtiot2Response) + HttpResponse.json(maatJaValtiot2Response), ), http.post(APIEndpoints.SubmitRegistration, () => - HttpResponse.json({ success: true }) + HttpResponse.json({ success: true }), ), ];