Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PortalMEC-React
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PortalMEC
PortalMEC-React
Commits
1d8d6a14
Commit
1d8d6a14
authored
4 years ago
by
lfr20
Browse files
Options
Downloads
Patches
Plain Diff
Nothing changed
parent
16fbd746
No related branches found
No related tags found
4 merge requests
!57
Merge of develop into master
,
!56
Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...
,
!40
merge admin into develop
,
!37
Merge sistema_admin into Update_Admin_System
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Components/MenuList.js
+90
-85
90 additions, 85 deletions
src/Components/MenuList.js
with
90 additions
and
85 deletions
src/Components/MenuList.js
+
90
−
85
View file @
1d8d6a14
...
...
@@ -16,7 +16,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with Plataforma Integrada MEC. If not, see <http://www.gnu.org/licenses/>.*/
import
React
,
{
useContext
}
from
'
react
'
;
import
React
,
{
useContext
}
from
'
react
'
;
import
Button
from
'
@material-ui/core/Button
'
;
import
Menu
from
'
@material-ui/core/Menu
'
;
import
MenuItem
from
'
@material-ui/core/MenuItem
'
;
...
...
@@ -28,15 +28,15 @@ import { Store } from '../Store';
import
{
Redirect
}
from
"
react-router-dom
"
;
import
Profile
from
'
../img/default_profile0.png
'
import
styled
from
'
styled-components
'
import
{
apiDomain
}
from
'
../env.js
'
import
{
apiDomain
}
from
'
../env.js
'
const
iconStyles
=
{
fontSize
:
"
xxx-large
"
,
fontSize
:
"
xxx-large
"
,
color
:
"
white
"
,
backgroundColor
:
"
gray
"
,
borderRadius
:
"
50%
"
,
overflow
:
"
hidden
"
,
border
:
"
2px solid #fff
"
,
borderRadius
:
"
50%
"
,
overflow
:
"
hidden
"
,
border
:
"
2px solid #fff
"
,
}
const
OverrideButton
=
styled
(
Button
)
`
...
...
@@ -44,87 +44,92 @@ const OverrideButton = styled(Button)`
`
export
default
function
MenuList
(
props
)
{
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
(
null
);
const
{
state
,
dispatch
}
=
useContext
(
Store
)
const
handleClick
=
event
=>
{
setAnchorEl
(
event
.
currentTarget
);
};
const
handleClose
=
()
=>
{
setAnchorEl
(
null
);
};
const
handleLogout
=
()
=>
{
localStorage
.
removeItem
(
'
@portalmec/username
'
);
sessionStorage
.
removeItem
(
'
@portalmec/uid
'
);
sessionStorage
.
removeItem
(
'
@portalmec/senha
'
);
dispatch
(
{
type
:
'
USER_LOGGED_OUT
'
,
userLoggedOut
:
!
state
.
userIsLoggedIn
,
login
:
{
username
:
''
,
email
:
''
,
accessToken
:
''
,
client
:
''
}
}
)
}
return
(
<
div
>
<
OverrideButton
aria
-
controls
=
"
customized-menu
"
aria
-
haspopup
=
"
true
"
onMouseEnter
=
{
handleClick
}
>
<
div
style
=
{{
borderRadius
:
"
50%
"
,
border
:
"
2px solid #fff
"
,
background
:
"
#fff
"
,
overflow
:
"
hidden
"
,
maxWidth
:
"
50px
"
,
maxHeight
:
"
50px
"
}}
>
{
state
.
currentUser
.
userAvatar
==
''
||
state
.
currentUser
.
userAvatar
==
null
?
(
<
img
src
=
{
Profile
}
alt
=
{
'
user avatar
'
}
style
=
{{
width
:
"
100%
"
,
height
:
"
100%
"
,
verticalAlign
:
"
middle
"
,
marginLeft
:
"
0
"
}}
/
>
):
(
<
img
src
=
{
apiDomain
+
state
.
currentUser
.
userAvatar
}
alt
=
{
'
user avatar
'
}
style
=
{{
width
:
"
100%
"
,
height
:
"
100%
"
,
verticalAlign
:
"
middle
"
,
marginLeft
:
"
0
"
}}
/
>
)
const
[
anchorEl
,
setAnchorEl
]
=
React
.
useState
(
null
);
const
{
state
,
dispatch
}
=
useContext
(
Store
)
const
handleClick
=
event
=>
{
setAnchorEl
(
event
.
currentTarget
);
};
const
handleClose
=
()
=>
{
setAnchorEl
(
null
);
};
const
handleLogout
=
()
=>
{
localStorage
.
removeItem
(
'
@portalmec/username
'
);
sessionStorage
.
removeItem
(
'
@portalmec/uid
'
);
sessionStorage
.
removeItem
(
'
@portalmec/senha
'
);
dispatch
({
type
:
'
USER_LOGGED_OUT
'
,
userLoggedOut
:
!
state
.
userIsLoggedIn
,
login
:
{
username
:
''
,
email
:
''
,
accessToken
:
''
,
client
:
''
}
<
/div
>
<
span
style
=
{{
fontFamily
:
"
inherit
"
,
fontWeight
:
"
400
"
,
color
:
"
#666
"
}}
>
Minha
Área
<
/span> <KeyboardArrowDownIcon/
>
<
/OverrideButton
>
<
Menu
anchorEl
=
{
anchorEl
}
open
=
{
Boolean
(
anchorEl
)}
onClose
=
{
handleClose
}
elevation
=
{
0
}
getContentAnchorEl
=
{
null
}
anchorOrigin
=
{{
vertical
:
'
bottom
'
,
horizontal
:
'
center
'
,
}}
transformOrigin
=
{{
vertical
:
'
top
'
,
horizontal
:
'
center
'
,
}}
>
{
props
.
items
.
map
((
item
)
=>
<
Link
to
=
{{
pathname
:
item
.
href
,
state
:
item
.
value
}}
style
=
{{
textDecoration
:
"
none
"
}}
key
=
{
item
.
value
}
><
MenuItem
style
=
{{
fontSize
:
"
14px
"
,
padding
:
"
5px 20px
"
,
color
:
"
#666
"
}}
>
{
item
.
name
}
<
/MenuItem></
Link
>
)
}
<
StyledButtonSair
onClick
=
{
handleLogout
}
>
<
StyledMenuItem
disableGutters
=
{
true
}
>
Sair
<
StyledExitToAppIcon
/><
/StyledMenuItem></
StyledButtonSair
>
)
}
<
/Menu
>
<
/div
>
);
return
(
<
div
>
<
OverrideButton
aria
-
controls
=
"
customized-menu
"
aria
-
haspopup
=
"
true
"
onMouseEnter
=
{
handleClick
}
>
<
div
style
=
{{
borderRadius
:
"
50%
"
,
border
:
"
2px solid #fff
"
,
background
:
"
#fff
"
,
overflow
:
"
hidden
"
,
maxWidth
:
"
50px
"
,
maxHeight
:
"
50px
"
}}
>
{
state
.
currentUser
.
userAvatar
==
''
||
state
.
currentUser
.
userAvatar
==
null
?
(
<
img
src
=
{
Profile
}
alt
=
{
'
user avatar
'
}
style
=
{{
width
:
"
100%
"
,
height
:
"
100%
"
,
verticalAlign
:
"
middle
"
,
marginLeft
:
"
0
"
}}
/
>
)
:
(
<
img
src
=
{
apiDomain
+
state
.
currentUser
.
userAvatar
}
alt
=
{
'
user avatar
'
}
style
=
{{
width
:
"
100%
"
,
height
:
"
100%
"
,
verticalAlign
:
"
middle
"
,
marginLeft
:
"
0
"
}}
/
>
)
}
<
/div
>
<
span
style
=
{{
fontFamily
:
"
inherit
"
,
fontWeight
:
"
400
"
,
color
:
"
#666
"
}}
>
Minha
Área
<
/span> <KeyboardArrowDownIcon /
>
<
/OverrideButton
>
<
Menu
anchorEl
=
{
anchorEl
}
open
=
{
Boolean
(
anchorEl
)}
onClose
=
{
handleClose
}
elevation
=
{
0
}
getContentAnchorEl
=
{
null
}
anchorOrigin
=
{{
vertical
:
'
bottom
'
,
horizontal
:
'
center
'
,
}}
transformOrigin
=
{{
vertical
:
'
top
'
,
horizontal
:
'
center
'
,
}}
>
{
props
.
items
.
map
((
item
)
=>
<
Link
to
=
{{
pathname
:
item
.
href
,
state
:
item
.
value
}}
style
=
{{
textDecoration
:
"
none
"
}}
key
=
{
item
.
value
}
>
<
MenuItem
style
=
{{
fontSize
:
"
14px
"
,
padding
:
"
5px 20px
"
,
color
:
"
#666
"
}}
>
{
item
.
name
}
<
/MenuItem
>
<
/Link
>
)
}
<
StyledButtonSair
onClick
=
{
handleLogout
}
>
<
StyledMenuItem
disableGutters
=
{
true
}
>
Sair
<
StyledExitToAppIcon
/><
/StyledMenuItem></
StyledButtonSair
>
<
/Menu
>
<
/div
>
);
}
const
StyledButtonSair
=
styled
(
Button
)
`
...
...
@@ -142,7 +147,7 @@ const StyledButtonSair = styled(Button)`
}
`
const
StyledExitToAppIcon
=
styled
(
ExitToAppIcon
)
`
const
StyledExitToAppIcon
=
styled
(
ExitToAppIcon
)
`
fontSize : 24px;
color : rgb(162,165,165);
align : right;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment