-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathErrors.tsx
55 lines (52 loc) · 1.53 KB
/
Errors.tsx
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
import styled from "@emotion/styled";
import { faExclamationTriangle } from "@fortawesome/pro-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { outputP3ColorFromRGB } from "../../helpers/colors";
import { useAppSelector } from "../../hooks";
const Failed = styled.div`
${outputP3ColorFromRGB([255, 0, 0])}
`;
export default function Errors() {
const weatherAlerts = useAppSelector((state) => state.weather.alerts);
const aviationAlerts = useAppSelector(
(state) => state.weather.aviationAlerts,
);
const tfrs = useAppSelector((state) => state.faa.tfrs);
const weather = useAppSelector((state) => state.weather.weather);
return (
<>
{weather === "failed" ? (
<Failed>
<FontAwesomeIcon icon={faExclamationTriangle} /> NWS hourly weather
failed to load.
</Failed>
) : (
""
)}
{weatherAlerts === "failed" ? (
<Failed>
<FontAwesomeIcon icon={faExclamationTriangle} /> Weather alerts failed
to load.
</Failed>
) : (
""
)}
{tfrs === "failed" ? (
<Failed>
<FontAwesomeIcon icon={faExclamationTriangle} /> Temporary flight
restrictions (TFRs) failed to load.
</Failed>
) : (
""
)}
{aviationAlerts === "failed" ? (
<Failed>
<FontAwesomeIcon icon={faExclamationTriangle} /> SIGMETs, G‑AIRMETs
and CWAs failed to load.
</Failed>
) : (
""
)}
</>
);
}