diff --git a/survey-frontend/src/App.tsx b/survey-frontend/src/App.tsx index f26d94d106bc2a37dc408a15c7fbf3515804bf72..4253ad86c795a9e3179be47685d00e432cfd55ae 100644 --- a/survey-frontend/src/App.tsx +++ b/survey-frontend/src/App.tsx @@ -1,13 +1,12 @@ import React, { ReactElement } from "react"; import { BrowserRouter as Router, Routes, Route } from "react-router-dom"; -import ShowUser from './ShowUser'; import SurveyManagementComponent from './SurveyManagementComponent'; import UserManagementComponent from './UserManagementComponent'; import SurveyContainerComponent from "./SurveyContainerComponent"; import ExternalPageNavBar from "shared/ExternalPageNavBar" import UserProvider from "./providers/UserProvider"; - +import Landing from "./Landing"; function App(): ReactElement { return ( @@ -22,7 +21,7 @@ function App(): ReactElement { <Route path="survey/admin/try/:year" element={<SurveyContainerComponent loadFrom={'/api/survey/try/'} />} /> <Route path="survey/respond/:year/:nren" element={<SurveyContainerComponent loadFrom={'/api/survey/load/'} saveTo={'/api/survey/save/'} />} /> <Route path="survey/show/:year/:nren" element={<SurveyContainerComponent loadFrom={'/api/survey/load/'} readonly />} /> - <Route path="*" element={<ShowUser />} /> + <Route path="*" element={<Landing />} /> </Routes> </UserProvider> </Router> diff --git a/survey-frontend/src/Landing.tsx b/survey-frontend/src/Landing.tsx new file mode 100644 index 0000000000000000000000000000000000000000..0381503d23fc3a2f6c4cf9451eeaf99901983246 --- /dev/null +++ b/survey-frontend/src/Landing.tsx @@ -0,0 +1,53 @@ +import React, { ReactElement, useContext } from "react"; +import { useNavigate } from "react-router-dom"; +import { Container, Row } from "react-bootstrap"; +import { userContext } from "./providers/UserProvider"; + +function Landing(): ReactElement { + const { user } = useContext(userContext); + const navigate = useNavigate(); + + const loggedIn = user.id !== undefined; + const hasNren = loggedIn ? !!user.nrens.length : false; + + const activeNren = hasNren ? user.nrens[0] : ''; + + const moveToSurvey = () => { + const currentYear = new Date().getFullYear(); + navigate(`/survey/respond/${currentYear}/${activeNren}`); + return <></> + } + + return ( + <Container className="py-5 grey-container"> + <Row> + <div className="center-text"> + <h1 className="geant-header">THE GÉANT COMPENDIUM OF NRENS SURVEY</h1> + + + <div className="wordwrap pt-4"> + <p style={{ textAlign: "center" }}> + Hello, Welcome to the GÉANT Compendium Survey. + NREN Compendium administrators can click here (link) to complete their registration to fill in the 2023 Compendium survey. + Once your registration has been confirmed you will receive an email from the Compendium administration team. + If you are not sure whether you are a Compendium Administrator for your NREN, please contact your GÉANT Partner Relations relationship manager. + Thank you. + </p> + + <span>Current registration status:</span> + <br /> + <br /> + <p> + {loggedIn ? "You are logged in" : "You are not logged in"} + {loggedIn && !hasNren ? ", but your access to the survey has not been approved" : moveToSurvey()} + </p> + </div> + + + </div> + </Row> + </Container > + ); +} + +export default Landing;