Skip to content

Commit

Permalink
AKR:YKI(Frontend): Take the updated Cookie banner into use [deploy]
Browse files Browse the repository at this point in the history
  • Loading branch information
lket committed Nov 28, 2023
1 parent b92ad7c commit c408d77
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 28 deletions.
2 changes: 1 addition & 1 deletion frontend/packages/akr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"akr:tslint": "yarn g:tsc --pretty --noEmit"
},
"dependencies": {
"shared": "npm:@opetushallitus/[email protected].1"
"shared": "npm:@opetushallitus/[email protected].2"
}
}
6 changes: 3 additions & 3 deletions frontend/packages/akr/public/i18n/en-GB/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@
},
"homepage": {
"cookieBanner": {
"buttonAriaLabel": "Accept cookies",
"buttonText": "Accept",
"buttonAriaLabel": "Close the notification about cookies",
"buttonText": "Close",
"description": "This web site uses mandatory cookies to be functional.",
"title": "Accept cookies"
"title": "Information about cookies"
},
"description": "The Finnish National Agency for Education maintains a register of authorised translators. You can use the search engine to find an authorised translator or several either by language pair, name, or municipality of residence. You can use the search form to leave a contact request to the translators you have selected. If there is a malfunction in the register, contact us by email: [email protected]",
"filters": {
Expand Down
6 changes: 3 additions & 3 deletions frontend/packages/akr/public/i18n/fi-FI/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,10 +457,10 @@
},
"homepage": {
"cookieBanner": {
"buttonAriaLabel": "Hyväksy evästeet",
"buttonText": "Hyväksy",
"buttonAriaLabel": "Sulje evästetiedot",
"buttonText": "Sulje",
"description": "Tämä sivusto käyttää välttämättömiä evästeitä toimiakseen.",
"title": "Hyväksy evästeet"
"title": "Tietoa sivuston evästeistä"
},
"description": "Opetushallitus ylläpitää auktorisoitujen kääntäjien rekisteriä. Hakukoneella voit hakea auktorisoitua kääntäjää/auktorisoituja kääntäjiä joko kieliparin, nimen tai asuinkunnan mukaan. Voit jättää yhteydenottopyynnön valitsemillesi kääntäjille alla. Jos rekisterissä on toimintahäiriö, ota yhteyttä Opetushallitukseen sähköpostitse: [email protected]",
"filters": {
Expand Down
8 changes: 4 additions & 4 deletions frontend/packages/akr/public/i18n/sv-SE/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -447,10 +447,10 @@
},
"homepage": {
"cookieBanner": {
"buttonAriaLabel": "Acceptera cookies",
"buttonText": "Acceptera",
"description": "Den här webbplatsen använder nödvändiga cookies för att fungera.",
"title": "Acceptera cookies"
"buttonAriaLabel": "Stäng informationrutan om kakor",
"buttonText": "Stäng",
"description": "Den här webbplatsen använder nödvändiga kakor för att fungera",
"title": "Information om kakor"
},
"description": "Utbildningsstyrelsen upprätthåller ett register över auktoriserade translatorer. Med sökmotorn kan du söka auktoriserade translatorer utgående från språkpar, på namn eller boendeort. Du kan lämna en kontaktförfrågan för de translatorer som du väljer nedan. I fall av ett funktionsfel i registret vänligen kontakta vår e-postadress: [email protected]",
"filters": {
Expand Down
18 changes: 18 additions & 0 deletions frontend/packages/akr/src/components/layouts/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { AppBar, Toolbar } from '@mui/material';
import { Link } from 'react-router-dom';
import {
CookieBanner,
LangSelector,
OPHClerkLogo,
OPHLogoViewer,
SkipLink,
Text,
} from 'shared/components';
import { AppLanguage, Direction } from 'shared/enums';
import { useWindowProperties } from 'shared/hooks';
Expand All @@ -25,6 +27,9 @@ export const Header = (): JSX.Element => {
const { t } = useAppTranslation({
keyPrefix: 'akr.component.header',
});
const { t: cookieTranslation } = useAppTranslation({
keyPrefix: 'akr.pages.homepage.cookieBanner',
});
const translateCommon = useCommonTranslation();
const [finnish, swedish, english] = getSupportedLangs();

Expand Down Expand Up @@ -90,6 +95,19 @@ export const Header = (): JSX.Element => {
</div>
</Toolbar>
</AppBar>
{!isClerkUI && (
<CookieBanner
title={cookieTranslation('title')}
buttonText={cookieTranslation('buttonText')}
cookieTag="cookie-consent-akr"
buttonAriaLabel={cookieTranslation('buttonAriaLabel')}
path="/akr"
>
<Text data-testid="cookie-banner-description">
{cookieTranslation('description')}
</Text>
</CookieBanner>
)}
</>
);
};
14 changes: 0 additions & 14 deletions frontend/packages/akr/src/pages/PublicHomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { Box, Grid } from '@mui/material';
import { FC, useEffect } from 'react';
import { CookieBanner, Text } from 'shared/components';

import { PublicTranslatorGrid } from 'components/publicTranslator/PublicTranslatorGrid';
import { useAppTranslation } from 'configs/i18n';
import { useAppDispatch, useAppSelector } from 'configs/redux';
import { PublicUIViews } from 'enums/app';
import { ContactRequestPage } from 'pages/ContactRequestPage';
Expand All @@ -12,9 +10,6 @@ import { publicUIViewSelector } from 'redux/selectors/publicUIView';

export const PublicHomePage: FC = () => {
const dispatch = useAppDispatch();
const { t } = useAppTranslation({
keyPrefix: 'akr.pages.homepage.cookieBanner',
});

useEffect(() => {
dispatch(loadPublicTranslators());
Expand All @@ -24,15 +19,6 @@ export const PublicHomePage: FC = () => {

return (
<Box className="public-homepage">
<CookieBanner
title={t('title')}
buttonText={t('buttonText')}
cookieTag="cookie-consent-akr"
buttonAriaLabel={t('buttonAriaLabel')}
path="/akr"
>
<Text data-testid="cookie-banner-description">{t('description')}</Text>
</CookieBanner>
<Grid
container
rowSpacing={4}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`Header should render Header correctly 1`] = `
Array [
<a
className="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways skip-link css-tvmhkj-MuiTypography-root-MuiLink-root"
className="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways skip-link css-1vrl3mg-MuiTypography-root-MuiLink-root"
href="#main-content"
onBlur={[Function]}
onFocus={[Function]}
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/yki/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"yki:tslint": "yarn g:tsc --pretty --noEmit"
},
"dependencies": {
"shared": "npm:@opetushallitus/[email protected].1"
"shared": "npm:@opetushallitus/[email protected].2"
},
"devDependencies": {
"multer": "^1.4.5-lts.1"
Expand Down
6 changes: 6 additions & 0 deletions frontend/packages/yki/public/i18n/en-GB/public.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"yki": {
"component": {
"cookieBanner": {
"buttonAriaLabel": "Close the notification about cookies",
"buttonText": "Close",
"description": "This web site uses mandatory cookies to be functional.",
"title": "Information about cookies"
},
"evaluationOrderForm": {
"actionButtons": {
"cancel": "Quit",
Expand Down
6 changes: 6 additions & 0 deletions frontend/packages/yki/public/i18n/fi-FI/public.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"yki": {
"component": {
"cookieBanner": {
"buttonAriaLabel": "Sulje evästetiedot",
"buttonText": "Sulje",
"description": "Tämä sivusto käyttää välttämättömiä evästeitä toimiakseen.",
"title": "Tietoa sivuston evästeistä"
},
"evaluationOrderForm": {
"actionButtons": {
"cancel": "Keskeytä",
Expand Down
6 changes: 6 additions & 0 deletions frontend/packages/yki/public/i18n/sv-SE/public.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"yki": {
"component": {
"cookieBanner": {
"buttonAriaLabel": "Stäng informationrutan om kakor",
"buttonText": "Stäng",
"description": "Den här webbplatsen använder nödvändiga kakor för att fungera",
"title": "Information om kakor"
},
"evaluationOrderForm": {
"actionButtons": {
"cancel": "Avbryt",
Expand Down
21 changes: 20 additions & 1 deletion frontend/packages/yki/src/components/layouts/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { AppBar, Toolbar } from '@mui/material';
import { Link } from 'react-router-dom';
import { LangSelector, OPHLogoViewer, SkipLink } from 'shared/components';
import {
CookieBanner,
LangSelector,
OPHLogoViewer,
SkipLink,
Text,
} from 'shared/components';
import { AppLanguage, Direction } from 'shared/enums';
import { useWindowProperties } from 'shared/hooks';

Expand All @@ -11,12 +17,16 @@ import {
getCurrentLang,
getSupportedLangs,
useCommonTranslation,
usePublicTranslation,
} from 'configs/i18n';
import { AppRoutes } from 'enums/app';

export const Header = (): JSX.Element => {
const translateCommon = useCommonTranslation();
const [finnish, swedish, english] = getSupportedLangs();
const { t } = usePublicTranslation({
keyPrefix: 'yki.component.cookieBanner',
});

const langDict = new Map<string, AppLanguage>([
[translateCommon('header.lang.fi'), finnish],
Expand Down Expand Up @@ -76,6 +86,15 @@ export const Header = (): JSX.Element => {
</div>
</Toolbar>
</AppBar>
<CookieBanner
title={t('title')}
buttonText={t('buttonText')}
cookieTag="cookie-consent-yki"
buttonAriaLabel={t('buttonAriaLabel')}
path="/yki"
>
<Text data-testid="cookie-banner-description">{t('description')}</Text>
</CookieBanner>
</>
);
};

0 comments on commit c408d77

Please sign in to comment.