@@ -4,6 +4,11 @@ import { BrowserRouter, Route, Routes } from 'react-router';
44import ActivitiesDetail from 'activities/detail' ;
55import Keycloak from 'keycloak-js' ;
66import { 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
813const 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} ;
0 commit comments