|
1 |
| -import { Flex, Icon, Image } from '@webkom/lego-bricks'; |
| 1 | +import { Flex, Icon, Image, LinkButton } from '@webkom/lego-bricks'; |
| 2 | +import { usePreparedEffect } from '@webkom/react-prepare'; |
2 | 3 | import cx from 'classnames';
|
3 | 4 | import { Facebook, Instagram, Linkedin, Slack } from 'lucide-react';
|
4 | 5 | import moment from 'moment-timezone';
|
5 | 6 | import { Link } from 'react-router-dom';
|
| 7 | +import { fetchSystemStatus } from 'app/actions/StatusActions'; |
6 | 8 | import netcompany from 'app/assets/netcompany_white.svg';
|
7 | 9 | import octocat from 'app/assets/octocat.png';
|
8 | 10 | import { useIsLoggedIn } from 'app/reducers/auth';
|
| 11 | +import { useAppDispatch, useAppSelector } from 'app/store/hooks'; |
9 | 12 | import utilityStyles from 'app/styles/utilities.css';
|
10 | 13 | import Circle from '../Circle';
|
11 | 14 | import styles from './Footer.module.css';
|
12 | 15 |
|
13 | 16 | const Footer = () => {
|
| 17 | + const dispatch = useAppDispatch(); |
| 18 | + const systemStatus = useAppSelector((state) => state.status.systemStatus); |
14 | 19 | const loggedIn = useIsLoggedIn();
|
| 20 | + |
| 21 | + usePreparedEffect( |
| 22 | + 'fetchSystemStatus', |
| 23 | + () => dispatch(fetchSystemStatus()), |
| 24 | + [], |
| 25 | + ); |
| 26 | + |
| 27 | + const getStatusColor = (status?: string) => { |
| 28 | + switch (status) { |
| 29 | + case 'operational': |
| 30 | + return 'var(--success-color)'; |
| 31 | + case 'degraded': |
| 32 | + return 'var(--color-orange-6)'; |
| 33 | + case 'major': |
| 34 | + return 'var(--danger-color)'; |
| 35 | + default: |
| 36 | + return 'var(--color-gray-6)'; |
| 37 | + } |
| 38 | + }; |
| 39 | + |
15 | 40 | return (
|
16 | 41 | <footer className={styles.footer}>
|
17 | 42 | <div className={styles.footerContent}>
|
@@ -54,6 +79,32 @@ const Footer = () => {
|
54 | 79 | Backend
|
55 | 80 | </a>
|
56 | 81 | </Flex>
|
| 82 | + {systemStatus?.status && systemStatus?.message && ( |
| 83 | + <LinkButton |
| 84 | + flat |
| 85 | + size="small" |
| 86 | + href="https://status.abakus.no" |
| 87 | + rel="noopener noreferrer" |
| 88 | + target="_blank" |
| 89 | + className={styles.statusLink} |
| 90 | + > |
| 91 | + <span className={styles.statusDot}> |
| 92 | + <span |
| 93 | + className={styles.statusDotPing} |
| 94 | + style={{ |
| 95 | + backgroundColor: getStatusColor(systemStatus.status), |
| 96 | + }} |
| 97 | + /> |
| 98 | + <span |
| 99 | + className={styles.statusDotCore} |
| 100 | + style={{ |
| 101 | + backgroundColor: getStatusColor(systemStatus.status), |
| 102 | + }} |
| 103 | + /> |
| 104 | + </span> |
| 105 | + {systemStatus.message} |
| 106 | + </LinkButton> |
| 107 | + )} |
57 | 108 | </div>
|
58 | 109 |
|
59 | 110 | <div className={cx(styles.section, styles.rightSection)}>
|
|
0 commit comments