mirror of
				https://github.com/Telecominfraproject/wlan-cloud-ui.git
				synced 2025-10-31 10:48:01 +00:00 
			
		
		
		
	Compare commits
	
		
			5 Commits
		
	
	
		
			v1.2.0-rc2
			...
			feature/NE
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 0439b052ca | ||
|   | 448a198c23 | ||
|   | f989132de6 | ||
|   | a6406e2be3 | ||
|   | 0748ddbed1 | 
							
								
								
									
										58
									
								
								app/components/UsersDropdown/index.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								app/components/UsersDropdown/index.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,58 @@ | ||||
| import React, { useState } from 'react'; | ||||
| import PropTypes from 'prop-types'; | ||||
| import { Link } from 'react-router-dom'; | ||||
| import { Popover, Row } from 'antd'; | ||||
| import { UserOutlined } from '@ant-design/icons'; | ||||
|  | ||||
| import styles from './index.module.scss'; | ||||
|  | ||||
| const UsersDropdown = ({ onLogout }) => { | ||||
|   const [popoverVisible, setPopoverVisible] = useState(false); | ||||
|  | ||||
|   const hidePopover = () => { | ||||
|     setPopoverVisible(false); | ||||
|   }; | ||||
|  | ||||
|   const handleVisibleChange = visible => { | ||||
|     setPopoverVisible(visible); | ||||
|   }; | ||||
|  | ||||
|   const userOptions = ( | ||||
|     <> | ||||
|       <Row> | ||||
|         <Link onClick={hidePopover} to="/account"> | ||||
|           Account | ||||
|         </Link> | ||||
|       </Row> | ||||
|       <Row> | ||||
|         <Link onClick={onLogout} to="/"> | ||||
|           Log Out | ||||
|         </Link> | ||||
|       </Row> | ||||
|     </> | ||||
|   ); | ||||
|  | ||||
|   return ( | ||||
|     <Popover | ||||
|       content={userOptions} | ||||
|       trigger="click" | ||||
|       getPopupContainer={e => e.parentElement} | ||||
|       visible={popoverVisible} | ||||
|       onVisibleChange={handleVisibleChange} | ||||
|       placement="bottomRight" | ||||
|       arrowPointAtCenter | ||||
|     > | ||||
|       <UserOutlined className={styles.MenuIcon} /> | ||||
|     </Popover> | ||||
|   ); | ||||
| }; | ||||
|  | ||||
| UsersDropdown.propTypes = { | ||||
|   onLogout: PropTypes.func, | ||||
| }; | ||||
|  | ||||
| UsersDropdown.defaultProps = { | ||||
|   onLogout: () => {}, | ||||
| }; | ||||
|  | ||||
| export default UsersDropdown; | ||||
							
								
								
									
										7
									
								
								app/components/UsersDropdown/index.module.scss
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								app/components/UsersDropdown/index.module.scss
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| .MenuIcon { | ||||
|     cursor: pointer; | ||||
|     font-size: 18px; | ||||
|     line-height: 64px; | ||||
|     padding: 0 24px; | ||||
|   } | ||||
|    | ||||
| @@ -12,8 +12,10 @@ import { removeItem } from 'utils/localStorage'; | ||||
|  | ||||
| import UserContext from 'contexts/UserContext'; | ||||
|  | ||||
| import UsersDropdown from 'components/UsersDropdown'; | ||||
|  | ||||
| const MasterLayout = ({ children }) => { | ||||
|   const { roles, customerId } = useContext(UserContext); | ||||
|   const { roles, customerId, email } = useContext(UserContext); | ||||
|  | ||||
|   const client = useApolloClient(); | ||||
|   const location = useLocation(); | ||||
| @@ -59,7 +61,7 @@ const MasterLayout = ({ children }) => { | ||||
|         { | ||||
|           key: 'editAccount', | ||||
|           path: ROUTES.account, | ||||
|           text: 'Edit Account', | ||||
|           text: 'Account', | ||||
|         }, | ||||
|         { | ||||
|           key: 'logout', | ||||
| @@ -90,6 +92,8 @@ const MasterLayout = ({ children }) => { | ||||
|       menuItems={menuItems} | ||||
|       mobileMenuItems={mobileMenuItems} | ||||
|       totalAlarms={data && data.getAlarmCount} | ||||
|       currentUserEmail={email} | ||||
|       usersDropdown={<UsersDropdown onLogout={handleLogout} />} | ||||
|     > | ||||
|       {children} | ||||
|     </Layout> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user