Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
concept-front-mojsprat-v2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Djordje Mutavdzic
concept-front-mojsprat-v2
Commits
012f73c6
Commit
012f73c6
authored
Jun 30, 2022
by
Djordje
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Abstract EntryPage and update routes to handle invalid buildingId
parent
51cc0c3f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
13 deletions
+23
-13
App.tsx
src/App.tsx
+8
-4
LoginForm.tsx
src/components/LoginForm.tsx
+6
-0
EntryPage.css
src/components/entry-page/EntryPage.css
+0
-0
EntryPage.tsx
src/components/entry-page/EntryPage.tsx
+4
-7
RegisterForm.tsx
src/components/register/RegisterForm.tsx
+5
-2
No files found.
src/App.tsx
View file @
012f73c6
import
React
from
'react'
;
import
logo
from
'./logo.svg'
;
import
'./App.css'
;
import
{
BrowserRouter
as
Router
,
Route
,
Routes
}
from
'react-router-dom'
import
{
Register
}
from
'./components/register/Register'
;
import
{
BrowserRouter
as
Router
,
Navigate
,
Route
,
Routes
}
from
'react-router-dom'
import
{
EntryPage
}
from
'./components/entry-page/EntryPage'
;
import
{
RegisterForm
}
from
'./components/register/RegisterForm'
;
import
{
LoginForm
}
from
'./components/LoginForm'
;
function
App
()
{
return
(
<
Router
>
<
Routes
>
<
Route
path=
'/'
element=
{
<
div
>
asd
</
div
>
}
/>
<
Route
path=
'register/:buildingId'
element=
{
<
Register
/>
}
/>
<
Route
path=
'register/:buildingId'
element=
{
<
EntryPage
children=
{
<
RegisterForm
/>
}
/>
}
/>
<
Route
path=
'register/error'
element=
{
<
EntryPage
children=
{
<
div
>
Invalid invitational link - screen to be implemented
</
div
>
}
/>
}
/>
<
Route
path=
'login'
element=
{
<
EntryPage
children=
{
<
LoginForm
/>
}
/>
}
/>
<
Route
path=
'*'
element=
{
<
Navigate
replace
to=
"login"
/>
}
/>
</
Routes
>
</
Router
>
);
...
...
src/components/LoginForm.tsx
0 → 100644
View file @
012f73c6
export
const
LoginForm
=
()
=>
{
return
(<
div
>
Hello from LoginForm
</
div
>)
}
\ No newline at end of file
src/components/
register/Register
.css
→
src/components/
entry-page/EntryPage
.css
View file @
012f73c6
File moved
src/components/
register/Register
.tsx
→
src/components/
entry-page/EntryPage
.tsx
View file @
012f73c6
import
React
from
"react"
import
'./Register.css'
;
import
{
RegisterForm
}
from
"./RegisterForm"
;
import
React
,
{
ReactNode
}
from
"react"
import
'./EntryPage.css'
;
export
const
Register
=
()
=>
{
export
const
EntryPage
=
({
children
}:
{
children
?:
ReactNode
}):
JSX
.
Element
=>
{
return
(
<
div
className=
"RegisterWrapper"
>
...
...
@@ -10,9 +9,8 @@ export const Register = () => {
<
img
src=
{
process
.
env
.
PUBLIC_URL
+
'/assets/logo-svg.svg'
}
alt=
'logo'
/>
</
div
>
<
div
className=
"Form"
>
<
RegisterForm
/>
{
children
}
</
div
>
</
div
>
)
}
\ No newline at end of file
src/components/register/RegisterForm.tsx
View file @
012f73c6
import
{
TextField
,
Box
,
Typography
,
Button
,
styled
,
ButtonProps
,
Select
,
FormControl
,
InputLabel
,
MenuItem
}
from
"@mui/material"
;
import
{
red
}
from
"@mui/material/colors"
;
import
React
,
{
useEffect
,
useState
}
from
"react"
;
import
{
useParams
}
from
"react-router-dom"
;
import
{
Navigate
,
useParams
}
from
"react-router-dom"
;
import
{
getPreRegisterData
}
from
"../../actions/data-manager"
;
import
{
RegistrationInfo
}
from
"../../internal-types"
;
...
...
@@ -58,16 +58,18 @@ const classes = {
}
}
as
const
;
export
const
RegisterForm
=
()
=>
{
export
const
RegisterForm
=
()
:
JSX
.
Element
=>
{
let
{
buildingId
}
=
useParams
();
const
[
buildingUnits
,
setBuildingUnits
]
=
useState
([]);
const
[
invalidUrl
,
setInvalidUrl
]
=
useState
(
false
);
const
[
registerInfo
,
setRegisterInfo
]
=
useState
<
RegistrationInfo
>
({
name
:
''
,
lastName
:
''
,
email
:
''
,
username
:
''
,
password
:
''
,
mobile
:
''
,
units
:
[]
});
useEffect
(()
=>
{
getPreRegisterData
(
buildingId
,
(
err
:
any
,
data
:
any
,
dsp
:
any
)
=>
{
if
(
err
)
{
setInvalidUrl
(
true
);
return
;
}
...
...
@@ -81,6 +83,7 @@ export const RegisterForm = () => {
return
(
<>
{
invalidUrl
&&
<
Navigate
replace
to=
'../register/error'
/>
}
{
buildingUnits
&&
<
div
style=
{
{
display
:
'flex'
,
flexDirection
:
'column'
,
gap
:
'20px'
}
}
>
<
Typography
sx=
{
{
fontFamily
:
'Inter'
,
fontWeight
:
'bold'
}
}
variant=
'h4'
>
Create Account
</
Typography
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment