Skip to content

Commit de4118b

Browse files
sebbalexenrimon15
andauthored
feat: add courtesy pages (#920)
* feat: add courtesy pages - bump: mui-italia to support new illustrations * feat(oneid-fe): multipage build with courtesy pages * chore(oneid-fe): remove unused courtesy constants --------- Co-authored-by: Enrico Monte <38566410+enrimon15@users.noreply.github.com>
1 parent ca70fb6 commit de4118b

File tree

12 files changed

+206
-13
lines changed

12 files changed

+206
-13
lines changed

src/oneid/oneid-fe/.env.development

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ VITE_CURRENT_ENV=LOCAL_DEV
66
DEV=true
77

88
VITE_PUBLIC_URL=
9-
VITE_CDN_URL=https://assets.dev.oneid.pagopa.it/assets
10-
VITE_LOGIN_ALERT_BANNER=https://assets.dev.oneid.pagopa.it/assets/login-alert-message.json
9+
VITE_CDN_URL=/assets
10+
VITE_LOGIN_ALERT_BANNER=/assets/login-alert-message.json
1111
VITE_LOGIN_IDP_LIST=/idps
1212
VITE_LOGIN_CLIENT_BASE_URL=/clients
1313
VITE_URL_API_LOGIN=/login

src/oneid/oneid-fe/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"@mui/icons-material": "^5.15.20",
1010
"@mui/lab": "^5.0.0-alpha.170",
1111
"@mui/material": "^5.15.20",
12-
"@pagopa/mui-italia": "^1.5.1",
12+
"@pagopa/mui-italia": "^1.8.0",
1313
"@tanstack/react-query": "^5.62.2",
1414
"@types/node": "^20.14.5",
1515
"@types/react": "^18.3.3",

src/oneid/oneid-fe/service-ko.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!DOCTYPE html>
2+
<html lang="it">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="robots" content="noindex" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta http-equiv="x-ua-compatible" content="ie=edge" />
8+
<meta http-equiv="cache-control" content="no-cache" />
9+
<meta http-equiv="expires" content="0" />
10+
<meta http-equiv="pragma" content="no-cache" />
11+
12+
<title>Servizio non disponibile · PagoPA S.p.A.</title>
13+
<meta name="description" content="Pagina di cortesia - Servizio non disponibile" />
14+
<meta name="theme-color" content="#00a1b0" />
15+
16+
<link rel="manifest" href="/asset-manifest.json" crossorigin="anonymous">
17+
<link rel="icon" href="/assets/favicon-32x32.png" type="image/png">
18+
<link rel="icon" href="/assets/favicon.svg" type="image/svg+xml">
19+
<link rel="apple-touch-icon" sizes="48x48" href="/assets/icons/icon-48x48.png">
20+
<link rel="apple-touch-icon" sizes="72x72" href="/assets/icons/icon-72x72.png">
21+
<link rel="apple-touch-icon" sizes="96x96" href="/assets/icons/icon-96x96.png">
22+
<link rel="apple-touch-icon" sizes="144x144" href="/assets/icons/icon-144x144.png">
23+
<link rel="apple-touch-icon" sizes="192x192" href="/assets/icons/icon-192x192.png">
24+
<link rel="apple-touch-icon" sizes="256x256" href="/assets/icons/icon-256x256.png">
25+
<link rel="apple-touch-icon" sizes="384x384" href="/assets/icons/icon-384x384.png">
26+
<link rel="apple-touch-icon" sizes="512x512" href="/assets/icons/icon-512x512.png">
27+
</head>
28+
29+
<body style="margin: 0;">
30+
<noscript>Abilita JavaScript per utilizzare quest'applicazione</noscript>
31+
<div id="root"></div>
32+
<script type="module" src="/src/courtesy/service-ko.tsx"></script>
33+
</body>
34+
</html>

src/oneid/oneid-fe/src/components/Layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ import Footer from './footer/Footer';
44
import { PRODUCTS_URL } from '../utils/constants';
55

66
type Props = {
7+
hidePreFooter?: boolean;
78
children: React.ReactNode;
89
};
910

10-
const Layout = ({ children }: Props) => {
11+
const Layout = ({ children, hidePreFooter = false }: Props) => {
1112
return (
1213
<Box
1314
bgcolor={'#F5F5F5'}
@@ -22,7 +23,7 @@ const Layout = ({ children }: Props) => {
2223

2324
{children}
2425
<Box mt={10}>
25-
<Footer productsJsonUrl={PRODUCTS_URL} />
26+
<Footer productsJsonUrl={PRODUCTS_URL} hidePreFooter={hidePreFooter} />
2627
</Box>
2728
</Box>
2829
);

src/oneid/oneid-fe/src/components/footer/Footer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import i18n from '../../locale';
1212
import { useLoginData } from '../../hooks/useLoginData';
1313

1414
type FooterProps = {
15+
hidePreFooter?: boolean;
1516
productsJsonUrl?: string;
1617
onExit?: (exitAction: () => void) => void;
1718
};
@@ -27,6 +28,7 @@ declare const window: Window &
2728
export default function Footer({
2829
productsJsonUrl,
2930
onExit = (exitAction) => exitAction(),
31+
hidePreFooter = false,
3032
}: FooterProps) {
3133
const { clientQuery } = useLoginData();
3234

@@ -230,7 +232,7 @@ export default function Footer({
230232
postLoginLinks={postLoginLinks}
231233
preLoginLinks={preLoginLinks}
232234
legalInfo={companyLegalInfo}
233-
loggedUser={false}
235+
loggedUser={hidePreFooter}
234236
onExit={onExit}
235237
languages={LANGUAGES as Languages}
236238
onLanguageChanged={async (language: LangCode) => {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import { ThemeProvider } from '@mui/material/styles';
4+
import { theme } from '@pagopa/mui-italia';
5+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
6+
import { ServiceKO } from '../pages/courtesy/ServiceKO';
7+
import '../locale';
8+
import '../global.css';
9+
10+
const rootEl = document.getElementById('root');
11+
12+
if (rootEl) {
13+
const root = createRoot(rootEl);
14+
const queryClient = new QueryClient();
15+
16+
root.render(
17+
<ThemeProvider theme={theme}>
18+
<React.StrictMode>
19+
<QueryClientProvider client={queryClient}>
20+
<ServiceKO />
21+
</QueryClientProvider>
22+
</React.StrictMode>
23+
</ThemeProvider>
24+
);
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import { createRoot } from 'react-dom/client';
3+
import { ThemeProvider } from '@mui/material/styles';
4+
import { theme } from '@pagopa/mui-italia';
5+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
6+
import { SwitchToIO } from '../pages/courtesy/SwitchToIO';
7+
import '../locale';
8+
import '../global.css';
9+
10+
const rootEl = document.getElementById('root');
11+
12+
if (rootEl) {
13+
const root = createRoot(rootEl);
14+
const queryClient = new QueryClient();
15+
16+
root.render(
17+
<ThemeProvider theme={theme}>
18+
<React.StrictMode>
19+
<QueryClientProvider client={queryClient}>
20+
<SwitchToIO />
21+
</QueryClientProvider>
22+
</React.StrictMode>
23+
</ThemeProvider>
24+
);
25+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { IllusUmbrella } from '@pagopa/mui-italia';
2+
import EndingPage from '../../components/EndingPage';
3+
import Layout from '../../components/Layout';
4+
import { Box } from '@mui/material';
5+
import { useTranslation } from 'react-i18next';
6+
7+
export const ServiceKO = () => {
8+
const { t } = useTranslation();
9+
const STATIC_URL = 'https://bonuselettrodomestici.it/utente';
10+
const handleRedirect = () => {
11+
window.location.assign(STATIC_URL);
12+
};
13+
return (
14+
<Layout hidePreFooter={true}>
15+
<Box pt={16} />
16+
<EndingPage
17+
icon={<IllusUmbrella size={60} />}
18+
variantTitle="h4"
19+
variantDescription="body1"
20+
title={'Qualcosa non va'}
21+
description={'Il sito non è al momento disponibile. Riprova più tardi.'}
22+
labelButton={t('loginError.close')}
23+
onClickButton={handleRedirect}
24+
variantButton={'contained'}
25+
haveTwoButtons={false}
26+
/>
27+
<Box pb={16} />
28+
</Layout>
29+
);
30+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { IllusUmbrella } from '@pagopa/mui-italia';
2+
import EndingPage from '../../components/EndingPage';
3+
import Layout from '../../components/Layout';
4+
import { Box } from '@mui/material';
5+
import { useTranslation } from 'react-i18next';
6+
7+
export const SwitchToIO = () => {
8+
const { t } = useTranslation();
9+
const STATIC_URL = 'https://bonuselettrodomestici.it/utente';
10+
const handleRedirect = () => {
11+
window.location.assign(STATIC_URL);
12+
};
13+
return (
14+
<Layout hidePreFooter={true}>
15+
<Box pt={16} />
16+
<EndingPage
17+
icon={<IllusUmbrella size={60} />}
18+
variantTitle="h4"
19+
variantDescription="body1"
20+
title={'Qualcosa non va'}
21+
description={
22+
'Il sito non è al momento disponibile, ma puoi accedere al Bonus Elettrodomestici dall’app IO.'
23+
}
24+
labelButton={t('loginError.close')}
25+
onClickButton={handleRedirect}
26+
variantButton={'contained'}
27+
haveTwoButtons={false}
28+
/>
29+
<Box pb={16} />
30+
</Layout>
31+
);
32+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<html lang="it">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="robots" content="noindex" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta http-equiv="x-ua-compatible" content="ie=edge" />
8+
<meta http-equiv="cache-control" content="no-cache" />
9+
<meta http-equiv="expires" content="0" />
10+
<meta http-equiv="pragma" content="no-cache" />
11+
12+
<title>Passa a IO · PagoPA S.p.A.</title>
13+
<meta name="description" content="Pagina di cortesia - Passa a IO" />
14+
<meta name="theme-color" content="#00a1b0" />
15+
16+
<link rel="manifest" href="/asset-manifest.json" crossorigin="anonymous">
17+
<link rel="icon" href="/assets/favicon-32x32.png" type="image/png">
18+
<link rel="icon" href="/assets/favicon.svg" type="image/svg+xml">
19+
<link rel="apple-touch-icon" sizes="48x48" href="/assets/icons/icon-48x48.png">
20+
<link rel="apple-touch-icon" sizes="72x72" href="/assets/icons/icon-72x72.png">
21+
<link rel="apple-touch-icon" sizes="96x96" href="/assets/icons/icon-96x96.png">
22+
<link rel="apple-touch-icon" sizes="144x144" href="/assets/icons/icon-144x144.png">
23+
<link rel="apple-touch-icon" sizes="192x192" href="/assets/icons/icon-192x192.png">
24+
<link rel="apple-touch-icon" sizes="256x256" href="/assets/icons/icon-256x256.png">
25+
<link rel="apple-touch-icon" sizes="384x384" href="/assets/icons/icon-384x384.png">
26+
<link rel="apple-touch-icon" sizes="512x512" href="/assets/icons/icon-512x512.png">
27+
28+
<body style="margin: 0;">
29+
<noscript>Abilita JavaScript per utilizzare quest'applicazione</noscript>
30+
<div id="root"></div>
31+
<script type="module" src="/src/courtesy/switch-to-io.tsx"></script>
32+
</body>
33+
</html>

0 commit comments

Comments
 (0)