Skip to content
Snippets Groups Projects
Commit 1d8d6a14 authored by lfr20's avatar lfr20
Browse files

Nothing changed

parent 16fbd746
No related branches found
No related tags found
4 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!40merge admin into develop,!37Merge sistema_admin into Update_Admin_System
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment