Skip to content

Commit cd8ccf3

Browse files
authored
Add Landing components to Staging Area (#4402)
* move input components to sub folder * Add Header/Footer/Logo * Implement soft landing page * replace initializing text with loading bar * whitespace * Linting
1 parent 7f987b7 commit cd8ccf3

19 files changed

Lines changed: 553 additions & 25 deletions

File tree

api-rework/client/src/activities/form-viewer/FormViewer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import Fieldset from 'common-components/Fieldset';
2-
import TextInput from 'common-components/TextInput';
3-
import TextField from 'common-components/TextField';
1+
import Fieldset from 'common-components/inputs/Fieldset';
2+
import TextInput from 'common-components/inputs/TextInput';
3+
import TextField from 'common-components/inputs/TextField';
44
import './formViewer.css';
5-
import Spacer from 'common-components/Spacer';
5+
import Spacer from 'common-components/inputs/Spacer';
66
import TerrestrialObservation from 'activities/subtypes/TerrestrialObservation';
77
import AquaticObservation from 'activities/subtypes/AquaticObservation';
88

api-rework/client/src/activities/subtypes/AquaticObservation.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import ChitList from 'common-components/ChitList';
2-
import Fieldset from 'common-components/Fieldset';
3-
import Spacer from 'common-components/Spacer';
4-
import TextInput from 'common-components/TextInput';
1+
import ChitList from 'common-components/inputs/ChitList';
2+
import Fieldset from 'common-components/inputs/Fieldset';
3+
import Spacer from 'common-components/inputs/Spacer';
4+
import TextInput from 'common-components/inputs/TextInput';
55
import { SubtypeData } from 'constants';
66

77
const AquaticObservation = ({ subtypeData }: SubtypeData) => {

api-rework/client/src/activities/subtypes/TerrestrialObservation.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Fieldset from 'common-components/Fieldset';
2-
import TextInput from 'common-components/TextInput';
1+
import Fieldset from 'common-components/inputs/Fieldset';
2+
import TextInput from 'common-components/inputs/TextInput';
33
import { SubtypeData } from 'constants';
44

55
const TerrestrialObservation = ({ subtypeData }: SubtypeData) => {

api-rework/client/src/client.css

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
:root {
2+
--header-height: 40px;
3+
--footer-height: 35px;
4+
}
5+
6+
.main {
7+
height: auto;
8+
overflow-y: auto;
9+
margin-top: calc(var(--header-height) + 5px);
10+
margin-bottom: calc(var(--footer-height) + 5px);
11+
box-sizing: border-box;
12+
}
13+
14+
.landing {
15+
font-size: 18px;
16+
text-align: center;
17+
font-family: Calibri, sans-serif;
18+
19+
p:not(:first-child) {
20+
margin-top: 0;
21+
}
22+
23+
.logo {
24+
height: 45vh;
25+
width: 45vh;
26+
}
27+
}

api-rework/client/src/client.tsx

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { BrowserRouter, Route, Routes } from 'react-router';
44
import ActivitiesDetail from 'activities/detail';
55
import Keycloak from 'keycloak-js';
66
import { produce } from 'immer';
7+
import Header from 'common-components/header/Header';
8+
import Footer from 'common-components/footer/Footer';
9+
import Logo from 'common-components/logo/Logo';
10+
import './client.css';
11+
import EndlessLoadingBar from 'common-components/endless-loading-bar/EndlessLoadingBar';
712

813
const MIN_FRESHNESS = 60;
914

@@ -142,6 +147,8 @@ const Client: React.FC = () => {
142147
});
143148
}, []);
144149

150+
const handleLogin = () => dispatch({ type: 'do_authentication' });
151+
const handleLogout = () => dispatch({ type: 'do_logout' });
145152
useEffect(() => {
146153
/* check every 5 seconds to see if we are going to expire */
147154
const id = setInterval(() => {
@@ -151,14 +158,27 @@ const Client: React.FC = () => {
151158
}, []);
152159

153160
if (!auth.initialized) {
154-
return <p>initializing</p>;
161+
return <EndlessLoadingBar />;
155162
}
156163

157164
if (!auth.authenticated) {
158165
return (
159166
<>
160-
<p>Please authenticate to proceed</p>
161-
<button onClick={() => dispatch({ type: 'do_authentication' })}>Authenticate</button>
167+
<Header authenticated={auth.authenticated} handleLogout={handleLogout} handleLogin={handleLogin} />
168+
<div className="main">
169+
<div className="content landing">
170+
<p>
171+
Welcome to the staging area for the InvasivesBC Normalization work. In order to proceed, please
172+
authenticate using your IDIR
173+
</p>
174+
<p>
175+
If you arrived here searching for the official InvasivesBC application, please head to{' '}
176+
<a href="https://invasivesbc.gov.bc.ca/">https://invasivesbc.gov.bc.ca/</a>
177+
</p>
178+
<Logo className="logo" />
179+
</div>
180+
</div>
181+
<Footer />
162182
</>
163183
);
164184
}
@@ -167,18 +187,20 @@ const Client: React.FC = () => {
167187
value={{
168188
state: auth
169189
}}>
170-
<pre>
171-
Welcome, {auth.user_details?.given_name} [{keycloakInstance.idTokenParsed?.sub}] [
172-
{keycloakInstance.idTokenParsed?.aud}]
173-
</pre>
174-
<button onClick={() => dispatch({ type: 'do_logout' })}>Logout</button>
175-
<BrowserRouter>
176-
<Routes>
177-
<Route path="/" element={<ActivitiesList />} />
178-
<Route path="/activities" element={<ActivitiesList />} />
179-
<Route path="/activities/:id" element={<ActivitiesDetail />} />
180-
</Routes>
181-
</BrowserRouter>
190+
<Header authenticated={auth.authenticated} handleLogout={handleLogout} handleLogin={handleLogin} />
191+
<div className="main">
192+
<pre>
193+
Welcome, {auth.user_details?.given_name} [{keycloakInstance.idTokenParsed?.sub}] [
194+
{keycloakInstance.idTokenParsed?.aud}]
195+
</pre>
196+
<BrowserRouter>
197+
<Routes>
198+
<Route path="/" element={<ActivitiesList />} />
199+
<Route path="/activities" element={<ActivitiesList />} />
200+
<Route path="/activities/:id" element={<ActivitiesDetail />} />
201+
</Routes>
202+
</BrowserRouter>
203+
</div>
182204
</AuthContext>
183205
);
184206
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { useEffect, useState } from 'react';
2+
import './endlessLoadingBar.css';
3+
4+
const EndlessLoadingBar = () => {
5+
const [count, setCount] = useState<number>(0);
6+
7+
useEffect(() => {
8+
const intervalId = setInterval(() => {
9+
setCount((prev) => (prev + 1) % 20);
10+
}, 400);
11+
return () => clearInterval(intervalId);
12+
}, []);
13+
14+
return (
15+
<div id="loading-bar-main">
16+
<p>Initializing Application</p>
17+
<div className="bar">
18+
{Array(count)
19+
.fill(0)
20+
.map(() => (
21+
<div className="progress" />
22+
))}
23+
</div>
24+
</div>
25+
);
26+
};
27+
28+
export default EndlessLoadingBar;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#loading-bar-main {
2+
position: absolute;
3+
z-index: 0;
4+
top: 50%;
5+
left: 50%;
6+
transform: translate(-50%, -50%);
7+
display: flex;
8+
flex-direction: column;
9+
border: 1pt solid black;
10+
color: white;
11+
background-color: #036;
12+
border-radius: 5px;
13+
height: 100px;
14+
width: 100%;
15+
max-width: 300px;
16+
align-items: center;
17+
18+
p {
19+
font-family: Calibri, sans-serif;
20+
font-size: 18px;
21+
}
22+
23+
.bar {
24+
display: flex;
25+
height: 25px;
26+
width: 211px;
27+
border: 1pt solid white;
28+
align-items: center;
29+
30+
& > * {
31+
margin-left: 1px;
32+
}
33+
}
34+
35+
.progress {
36+
display: flex;
37+
height: 18px;
38+
width: 10px;
39+
background-color: #fcba19;
40+
}
41+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import sunriseLogo from './bcGovSunriseLogo.png';
2+
import './footer.css';
3+
4+
const INFORMATIONAL_LINKS = [
5+
{ label: 'Copyright', url: 'https://www2.gov.bc.ca/gov/content/home/copyright ' },
6+
{ label: 'Disclaimer', url: 'https://www2.gov.bc.ca/gov/content/home/disclaimer ' },
7+
{ label: 'Privacy Statement', url: 'https://www2.gov.bc.ca/gov/content/home/privacy' },
8+
{ label: 'Accessibility', url: 'https://www2.gov.bc.ca/gov/content/home/accessible-government' }
9+
];
10+
11+
const Footer = () => {
12+
return (
13+
<footer className="FooterBar">
14+
<img alt="bcLogo" src={sunriseLogo} />
15+
<nav>
16+
{INFORMATIONAL_LINKS.map((link) => (
17+
<a className={'footerLinks'} key={link.label} href={link.url} target="_blank" rel="noopener noreferrer">
18+
{link.label}
19+
</a>
20+
))}
21+
</nav>
22+
</footer>
23+
);
24+
};
25+
26+
export default Footer;
28.2 KB
Loading
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
footer {
2+
position: fixed;
3+
bottom: 0;
4+
left: 0;
5+
width: 100%;
6+
display: flex;
7+
flex-direction: row;
8+
background-color: #036;
9+
height: var(--footer-height);
10+
align-items: center;
11+
justify-content: flex-start;
12+
13+
nav {
14+
display: flex;
15+
width: 100%;
16+
max-width: 1100px;
17+
margin: 1rem;
18+
justify-content: space-between;
19+
}
20+
21+
img {
22+
height: 33px;
23+
}
24+
25+
a {
26+
margin: 0 0.25rem;
27+
color: white;
28+
text-decoration: none;
29+
font-family: Calibri, sans-serif;
30+
}
31+
}

0 commit comments

Comments
 (0)