Repository navigation
Expand file tree
/
Copy pathProblemWithService.tsx
More file actions
executable file
·74 lines (69 loc) · 2.13 KB
/
Copy pathProblemWithService.tsx
File metadata and controls
executable file
·74 lines (69 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import React from "react";
import { useLocation } from "react-router";
import { ProblemWithServiceProps } from "./ProblemWithService.types";
import { Main } from "../Main";
import { LinkWithRef } from "../LinkWithRef";
const ProblemWithService: React.FC<ProblemWithServiceProps> = ({
message = "",
applicationName = "Document and plan retrieval system",
applicationRoute = "/",
reportingLink = "http://marval-live/MSMselfservice/AutoGen.aspx?page=1268",
basePageName = "dashboard",
}) => {
const { state } = useLocation();
const determineMessage = state?.message || message;
const determineApplicationName = state?.applicationName || applicationName;
const refreshPage = (): void => {
if (window.location.pathname === "/") window.location.reload();
};
const hasMessage = (): boolean => Boolean(determineMessage?.trim());
return (
<Main>
<h1 className="govuk-heading-xl">
Sorry, there is a problem with the service
</h1>
{hasMessage() && (
<div
className="govuk-error-summary"
aria-labelledby="error-summary-title"
role="alert"
tabIndex={-1}
data-module="govuk-error-summary"
>
<div className="govuk-error-summary__body">
<p>{determineMessage}</p>
</div>
</div>
)}
<p className="govuk-body">Try again later.</p>
<p className="govuk-body">
You can go back to{" "}
<LinkWithRef
className="govuk-link"
to={applicationRoute}
onClick={refreshPage}
>
{determineApplicationName}
</LinkWithRef>{" "}
{basePageName}.
</p>
<p className="govuk-body">
If the problem continues
<a
href={reportingLink}
className="govuk-link"
target="_blank"
rel="noreferrer"
>
contact support
<span className="nav-panel__text opens-in-new-window" />
<span className="visually-hidden">
(Opens in a new window or tab)
</span>
</a>
.
</p>
</Main>
);
};
export default ProblemWithService;