Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
Homework_95_Tsoy_Danil
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
Цой Данил
Homework_95_Tsoy_Danil
Commits
8869621f
Commit
8869621f
authored
Apr 13, 2023
by
Цой Данил
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added props and their values
parent
e4d04c8a
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
21 deletions
+20
-21
ChatWindow.js
frontend/src/Components/ChatWindow/ChatWindow.js
+0
-1
Login.js
frontend/src/Components/Login/Login.js
+2
-2
Message.js
frontend/src/Components/Message/Message.js
+3
-3
Navigation.js
frontend/src/Components/Navigation/Navigation.js
+2
-2
ProtectedRoute.js
frontend/src/Components/ProtectedRoute/ProtectedRoute.js
+4
-4
Register.js
frontend/src/Components/Register/Register.js
+4
-4
User.js
frontend/src/Components/User/User.js
+3
-3
UserList.js
frontend/src/Components/UserList/UserList.js
+2
-2
No files found.
frontend/src/Components/ChatWindow/ChatWindow.js
View file @
8869621f
...
@@ -3,7 +3,6 @@ import Button from '@mui/material/Button';
...
@@ -3,7 +3,6 @@ import Button from '@mui/material/Button';
import
Message
from
'../Message/Message'
;
import
Message
from
'../Message/Message'
;
import
'./ChatWindow.css'
;
import
'./ChatWindow.css'
;
const
ChatWindow
=
(
props
)
=>
{
const
ChatWindow
=
(
props
)
=>
{
return
(
return
(
<
div
className
=
'window'
>
<
div
className
=
'window'
>
...
...
frontend/src/Components/Login/Login.js
View file @
8869621f
...
@@ -8,7 +8,7 @@ import Spinner from "../UI/Spinner/Spinner";
...
@@ -8,7 +8,7 @@ import Spinner from "../UI/Spinner/Spinner";
import
'./Login.css'
;
import
'./Login.css'
;
const
Login
=
(
{
loginState
}
)
=>
{
const
Login
=
(
props
)
=>
{
const
{
loginError
,
isLoading
}
=
useSelector
(
state
=>
state
.
users
,
shallowEqual
);
const
{
loginError
,
isLoading
}
=
useSelector
(
state
=>
state
.
users
,
shallowEqual
);
const
navigate
=
useNavigate
(
'/'
);
const
navigate
=
useNavigate
(
'/'
);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
...
@@ -32,7 +32,7 @@ const Login = ({loginState}) => {
...
@@ -32,7 +32,7 @@ const Login = ({loginState}) => {
};
};
return
(
return
(
<
div
className
=
{
loginState
}
>
<
div
className
=
{
props
.
loginState
}
>
{
isLoading
?
<
Spinner
/>
:
null
}
{
isLoading
?
<
Spinner
/>
:
null
}
{
loginError
&&
<
MyAlert
alertText
=
{
loginError
.
error
}
/>
}
{
loginError
&&
<
MyAlert
alertText
=
{
loginError
.
error
}
/>
}
<
Form
<
Form
...
...
frontend/src/Components/Message/Message.js
View file @
8869621f
...
@@ -2,11 +2,11 @@ import React from "react";
...
@@ -2,11 +2,11 @@ import React from "react";
import
'./Message.css'
;
import
'./Message.css'
;
const
Message
=
(
{
author
,
message
}
)
=>
{
const
Message
=
(
props
)
=>
{
return
(
return
(
<
div
className
=
"Message"
>
<
div
className
=
"Message"
>
<
h3
className
=
"author"
>
{
author
}:
<
/h3
>
<
h3
className
=
"author"
>
{
props
.
author
}:
<
/h3
>
<
p
className
=
"authorMessage"
>
{
message
}
<
/p
>
<
p
className
=
"authorMessage"
>
{
props
.
message
}
<
/p
>
<
/div
>
<
/div
>
);
);
};
};
...
...
frontend/src/Components/Navigation/Navigation.js
View file @
8869621f
...
@@ -3,10 +3,10 @@ import { NavLink } from "react-router-dom";
...
@@ -3,10 +3,10 @@ import { NavLink } from "react-router-dom";
import
'./Navigation.css'
;
import
'./Navigation.css'
;
const
Navigation
=
(
{
to
,
end
,
children
}
)
=>
{
const
Navigation
=
(
props
)
=>
{
return
(
return
(
<
span
className
=
"NavLink"
>
<
span
className
=
"NavLink"
>
<
NavLink
to
=
{
to
}
end
=
{
end
}
>
{
children
}
<
/NavLink
>
<
NavLink
to
=
{
props
.
to
}
end
=
{
props
.
end
}
>
{
props
.
children
}
<
/NavLink
>
<
/span
>
<
/span
>
);
);
};
};
...
...
frontend/src/Components/ProtectedRoute/ProtectedRoute.js
View file @
8869621f
import
React
from
'react'
;
import
React
from
'react'
;
import
{
Navigate
,
Outlet
}
from
'react-router-dom'
;
import
{
Navigate
,
Outlet
}
from
'react-router-dom'
;
const
ProtectedRoute
=
(
{
isAllowed
,
redirectedPath
,
children
}
)
=>
{
const
ProtectedRoute
=
(
props
)
=>
{
if
(
!
isAllowed
)
{
if
(
!
props
.
isAllowed
)
{
return
<
Navigate
to
=
{
redirectedPath
}
replace
/>
return
<
Navigate
to
=
{
props
.
redirectedPath
}
replace
/>
}
}
return
(
return
(
<>
<>
{
children
||
<
Outlet
/>
}
{
props
.
children
||
<
Outlet
/>
}
<
/
>
<
/
>
);
);
};
};
...
...
frontend/src/Components/Register/Register.js
View file @
8869621f
...
@@ -7,7 +7,7 @@ import Spinner from "../UI/Spinner/Spinner";
...
@@ -7,7 +7,7 @@ import Spinner from "../UI/Spinner/Spinner";
import
'./Register.css'
;
import
'./Register.css'
;
const
Register
=
(
{
registerState
}
)
=>
{
const
Register
=
(
props
)
=>
{
const
{
registerError
,
isLoading
}
=
useSelector
(
state
=>
state
.
users
,
shallowEqual
);
const
{
registerError
,
isLoading
}
=
useSelector
(
state
=>
state
.
users
,
shallowEqual
);
const
dispatch
=
useDispatch
();
const
dispatch
=
useDispatch
();
...
@@ -21,15 +21,15 @@ const Register = ({registerState}) => {
...
@@ -21,15 +21,15 @@ const Register = ({registerState}) => {
setState
(
prevState
=>
({...
prevState
,
[
name
]:
value
}));
setState
(
prevState
=>
({...
prevState
,
[
name
]:
value
}));
};
};
const
submitHandler
=
async
(
e
)
=>
{
const
submitHandler
=
(
e
)
=>
{
e
.
preventDefault
();
e
.
preventDefault
();
await
dispatch
(
registerUser
({
dispatch
(
registerUser
({
userData
:
{...
state
}
userData
:
{...
state
}
}));
}));
};
};
return
(
return
(
<
div
className
=
{
registerState
}
>
<
div
className
=
{
props
.
registerState
}
>
{
isLoading
?
<
Spinner
/>
:
null
}
{
isLoading
?
<
Spinner
/>
:
null
}
{
registerError
&&
<
MyAlert
alertText
=
{
registerError
.
errors
[
'username'
].
message
}
/>
}
{
registerError
&&
<
MyAlert
alertText
=
{
registerError
.
errors
[
'username'
].
message
}
/>
}
<
Form
<
Form
...
...
frontend/src/Components/User/User.js
View file @
8869621f
...
@@ -5,7 +5,7 @@ import Avatar from '@mui/material/Avatar';
...
@@ -5,7 +5,7 @@ import Avatar from '@mui/material/Avatar';
import
'./User.css'
;
import
'./User.css'
;
const
User
=
(
{
user
}
)
=>
{
const
User
=
(
props
)
=>
{
const
StyledBadge
=
styled
(
Badge
)(({
theme
})
=>
({
const
StyledBadge
=
styled
(
Badge
)(({
theme
})
=>
({
'& .MuiBadge-badge'
:
{
'& .MuiBadge-badge'
:
{
backgroundColor
:
'#44b700'
,
backgroundColor
:
'#44b700'
,
...
@@ -42,9 +42,9 @@ const User = ({user}) => {
...
@@ -42,9 +42,9 @@ const User = ({user}) => {
anchorOrigin
=
{{
vertical
:
'bottom'
,
horizontal
:
'right'
}}
anchorOrigin
=
{{
vertical
:
'bottom'
,
horizontal
:
'right'
}}
variant
=
"dot"
variant
=
"dot"
>
>
<
Avatar
sx
=
{{
bgcolor
:
'blueviolet'
}}
>
{
user
}
<
/Avatar
>
<
Avatar
sx
=
{{
bgcolor
:
'blueviolet'
}}
>
{
props
.
user
}
<
/Avatar
>
<
/StyledBadge
>
<
/StyledBadge
>
<
p
className
=
"username"
>
{
user
}
<
/p
>
<
p
className
=
"username"
>
{
props
.
user
}
<
/p
>
<
/div
>
<
/div
>
);
);
};
};
...
...
frontend/src/Components/UserList/UserList.js
View file @
8869621f
...
@@ -3,12 +3,12 @@ import User from "../User/User";
...
@@ -3,12 +3,12 @@ import User from "../User/User";
import
'./UserList.css'
;
import
'./UserList.css'
;
const
UserList
=
(
{
users
}
)
=>
{
const
UserList
=
(
props
)
=>
{
return
(
return
(
<
div
className
=
"UserList"
>
<
div
className
=
"UserList"
>
<
p
className
=
"onlineUser"
>
Online
users
<
/p
>
<
p
className
=
"onlineUser"
>
Online
users
<
/p
>
{
{
users
.
map
((
user
,
idx
)
=>
{
props
.
users
.
length
&&
props
.
users
.
map
((
user
,
idx
)
=>
{
return
(
return
(
<
User
key
=
{
user
.
_id
+
idx
}
user
=
{
user
.
username
}
/
>
<
User
key
=
{
user
.
_id
+
idx
}
user
=
{
user
.
username
}
/
>
)
)
...
...
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