-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * WAITP-1202 Working basic routing * WAITP-1202 Add constants to index * WAITP-1202 fix merge conflicts * WAITP-1202 tidy up code * WAITP-1202 update format * WAITP-1202 tweaks * WAITP-1202 Update routing variables * WAITP-1202 Fix mismatched TS versions * Revert "WAITP-1202 Fix mismatched TS versions" This reverts commit 607d341. * WAITP-1202 fix version of react-router * WAITP-1202 updated routes for v6.3 * WAITP-1202 fix config and types version * WAITP-1202 Update validation
- Loading branch information
Showing
17 changed files
with
186 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom'; | ||
import { | ||
LandingPage, | ||
LoginForm, | ||
PasswordResetForm, | ||
Project, | ||
RegisterForm, | ||
RequestAccessForm, | ||
VerifyEmailForm, | ||
} from './pages'; | ||
import { DEFAULT_URL } from './constants'; | ||
|
||
/** | ||
* This Router is using [version 6.3]{@link https://reactrouter.com/en/v6.3.0}, as later versions are not supported by our TS setup. See [this issue here]{@link https://github.com/remix-run/react-router/discussions/8364} | ||
* This means the newer 'createBrowserRouter' and 'RouterProvider' can't be used here. | ||
* | ||
* **/ | ||
|
||
export const Router = () => ( | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<Navigate to={`/${DEFAULT_URL}`} replace />} /> | ||
{/** | ||
* The below user pages will actually be modals, which will be done when each view is created. There is an example at: https://github.com/remix-run/react-router/tree/dev/examples/modal | ||
*/} | ||
<Route path="login" element={<LoginForm />} /> | ||
<Route path="register" element={<RegisterForm />} /> | ||
<Route path="reset-password" element={<PasswordResetForm />} /> | ||
<Route path="request-access" element={<RequestAccessForm />} /> | ||
<Route path="verify-email" element={<VerifyEmailForm />} /> | ||
<Route path="/:landingPageUrlSegment" element={<LandingPage />} /> | ||
{/** Because react-router v 6.3 doesn't support optional url segments, we need to handle dashboardCode with a splat/catch-all instead */} | ||
<Route path="/:projectCode/:entityCode/*" element={<Project />} /> | ||
</Routes> | ||
</BrowserRouter> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/** | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
|
||
export const DEFAULT_PROJECT_CODE = 'explore'; | ||
export const DEFAULT_ENTITY_CODE = 'explore'; | ||
export const DEFAULT_URL = `${DEFAULT_PROJECT_CODE}/${DEFAULT_ENTITY_CODE}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
export * from './constants'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
export const LandingPage = () => { | ||
const { landingPageUrlSegment } = useParams(); | ||
// use the landingPageUrlSegment to query for the landing page. | ||
// If found, render landing page. If not, render a default landing page | ||
return <div>{landingPageUrlSegment}</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
|
||
export const LoginForm = () => { | ||
return <div>LoginForm</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
|
||
export const PasswordResetForm = () => { | ||
return <div>PasswordResetForm</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
|
||
export const Project = () => { | ||
// Use these to fetch the project and any other entity info you might need | ||
const { projectCode, entityCode, '*': dashboardCode } = useParams(); | ||
|
||
return ( | ||
<div> | ||
<h1>Project: {projectCode}</h1> | ||
<h2>Entity: {entityCode}</h2> | ||
<h3>Dashboard: {dashboardCode}</h3> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
|
||
export const RegisterForm = () => { | ||
return <div>RegisterForm</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
|
||
export const RequestAccessForm = () => { | ||
return <div>RequestAccessForm</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Tupaia | ||
* Copyright (c) 2017 - 2023 Beyond Essential Systems Pty Ltd | ||
*/ | ||
import React from 'react'; | ||
|
||
export const VerifyEmailForm = () => { | ||
return <div>VerifyEmailForm</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters