File indexing completed on 2025-01-26 05:27:59
0001 import React,{useContext} from 'react'; 0002 import UserLoginMenuContainer from './UserLoginMenuContainer'; 0003 import DevelopmentAppMenu from './DevelopmentAppMenu'; 0004 import AboutMenu from './AboutMenu'; 0005 import DiscussionBoardsDropDownMenu from './DiscussionBoardsDropDownMenu'; 0006 import {MetaheaderContext} from '../contexts/MetaheaderContext'; 0007 0008 const UserMenu = (props) => { 0009 const {state} = useContext(MetaheaderContext); 0010 let userDropdownDisplay, developmentAppMenuDisplay; 0011 if (state.user && state.user.member_id) { 0012 userDropdownDisplay = ( 0013 <UserLoginMenuContainer 0014 onSwitchStyle={props.onSwitchStyle} 0015 onSwitchStyleChecked={props.onSwitchStyleChecked} 0016 onSwitchMetaHeaderStyle={props.onSwitchMetaHeaderStyle} 0017 siteTheme={props.siteTheme} 0018 metamenuTheme={props.metamenuTheme} 0019 /> 0020 ); 0021 0022 0023 developmentAppMenuDisplay = ( 0024 <DevelopmentAppMenu /> 0025 ); 0026 } else { 0027 userDropdownDisplay = ( 0028 <React.Fragment> 0029 <li id="user-register-container"><a href={state.baseUrl + "/register"}>Register</a> or</li> 0030 <li id="user-login-container"><a href={state.loginUrl} className="btn btn-metaheader">Login</a></li> 0031 </React.Fragment> 0032 ) 0033 } 0034 0035 let chatItem = (<li id="chat-link-item"><a href={state.riotUrl}> 0036 <img src={state.baseUrl + "/theme/react/assets/img/chat.png"} className="riotIcon"></img>Chat 0037 </a></li>); 0038 0039 0040 let userMenuContainerDisplay; 0041 if (props.device === "large") { 0042 0043 0044 userMenuContainerDisplay = ( 0045 <ul className="metaheader-menu right" id="user-menu"> 0046 <DiscussionBoardsDropDownMenu /> 0047 <AboutMenu /> 0048 {chatItem} 0049 {developmentAppMenuDisplay} 0050 {userDropdownDisplay} 0051 </ul> 0052 ); 0053 } else { 0054 userMenuContainerDisplay = ( 0055 <ul className="metaheader-menu right" id="user-menu"> 0056 {props.device === "mid" && chatItem} 0057 {developmentAppMenuDisplay} 0058 {userDropdownDisplay} 0059 </ul> 0060 ); 0061 } 0062 0063 return ( 0064 <> 0065 {userMenuContainerDisplay} 0066 </> 0067 ) 0068 } 0069 0070 export default UserMenu 0071