File indexing completed on 2025-01-26 05:27:58

0001 import React, { useContext} from 'react';
0002 import MoreDropDownMenu from './MoreDropDownMenu';
0003 import DomainsMenu_subdomain from './DomainsMenu_subdomain';
0004 
0005 import {MetaheaderContext} from '../contexts/MetaheaderContext';
0006 
0007 const DomainsMenu = (props) => {
0008   const {state} = useContext(MetaheaderContext);
0009   let moreMenuItemDisplay;
0010   if (props.device !== "large") {
0011     moreMenuItemDisplay = (
0012       <MoreDropDownMenu  />
0013     )
0014   }
0015 
0016   let opendesktopLabel = 'opendesktop.org';
0017   if(state.baseUrl.endsWith('cc'))
0018   {
0019     opendesktopLabel = 'opendesktop.cc';
0020   }
0021   let plingLabel = 'pling';
0022   let opencodeLabel = 'opencode.net';
0023     
0024   let cls =(props.onSwitchStyleChecked?'dark':'active');
0025   if(state.target && state.target.target=='gitlab')
0026   {      
0027       cls = cls=='dark' ? 'gitlab':'active';        
0028   }
0029 
0030   let dT;  
0031   if (state.target) {
0032     switch (state.target.target) {
0033       case 'opendesktop':
0034         dT =(
0035           <>
0036             <li className={cls}>              
0037               <a id="opendesktop-logo-single" href={state.baseUrl} >
0038                 <img src={state.baseUrl + "/images/system/ocs-logo-rounded-16x16.png"} className="logo" />
0039                 {opendesktopLabel} 
0040               </a>
0041             </li>            
0042             <li><a href={state.gitlabUrl + "/explore/projects"}>{opencodeLabel}</a></li>
0043             <li><a href={state.baseUrlStore}>{plingLabel}</a></li>
0044           </>
0045         );
0046         break;
0047         case 'pling':
0048           dT =(
0049             <>
0050               <li className={cls}>
0051                 <a id="pling-logo" href={state.baseUrlStore}>
0052                   <span><img src={state.baseUrlStore + "/theme/react/assets/img/logo-pling.png"} className="logo" />
0053                 </span> :                    
0054                 </a>  
0055                 <DomainsMenu_subdomain domains={state.domains} 
0056                                       baseUrlStore={state.baseUrlStore}
0057                                       storeConfig ={state.storeConfig}
0058                                       />                   
0059               </li>
0060               <li><a href={state.baseUrl}>{opendesktopLabel} </a></li>
0061               <li><a href={state.gitlabUrl + "/explore/projects"}>{opencodeLabel}</a></li>
0062             </>
0063           );
0064           break;
0065         case 'kde-store':
0066           dT =(
0067             <>
0068               <li className={cls}>
0069                 <a id="kdeStore-logo" href={state.target.link}>
0070                   <img src={state.baseUrlStore + "/images_sys/store_kde/logo.png"} className="logo" />
0071                   { state.target.logoLabel }
0072                 </a>
0073               </li>             
0074               <li><a href={state.baseUrl}>{opendesktopLabel} </a></li>
0075               <li><a href={state.gitlabUrl + "/explore/projects"}>{opencodeLabel}</a></li>
0076               <li><a href={state.baseUrlStore}>{plingLabel}</a></li>
0077             </>
0078           );
0079           break;
0080         case 'gitlab':
0081           dT =(
0082             <>
0083               <li className={cls}>
0084                 <a id="gitlab-logo" href={state.gitlabUrl + "/explore/projects"}>
0085                   <img src={state.baseUrl + "/theme/react/assets/img/logo-opencode.png"} className="logo" />
0086                   {opencodeLabel} 
0087                 </a>
0088               </li>
0089               <li><a href={state.baseUrl}>{opendesktopLabel} </a></li>
0090               <li><a href={state.baseUrlStore}>{plingLabel}</a></li>                            
0091             </>
0092           );
0093           break;
0094         case 'forum':
0095             
0096             let logoLabel =  window.location.href.indexOf('messages')>0 ? 'DM' : state.target.logoLabel;
0097             
0098             dT =(
0099               <>
0100                 <li className={cls}>                 
0101                     <a id="opendesktop-logo" href={state.baseUrl} >
0102                       <img src={state.baseUrl + "/images/system/ocs-logo-rounded-16x16.png"} className="logo" />
0103                       {opendesktopLabel} : 
0104                     </a>
0105                     <a href={state.target.link} style={{paddingLeft:'0px',marginLeft:'0px'}} >
0106                       <span className="target">{logoLabel}</span>
0107                     </a>                  
0108                 </li>                
0109                 <li><a href={state.gitlabUrl + "/explore/projects"}>{opencodeLabel}</a></li>
0110                 <li><a href={state.baseUrlStore}>{plingLabel}</a></li>
0111               </>
0112             );
0113             break;
0114       default:          
0115           dT =(
0116             <>
0117               <li className={cls}>                 
0118                   <a id="opendesktop-logo" href={state.baseUrl} >
0119                     <img src={state.baseUrl + "/images/system/ocs-logo-rounded-16x16.png"} className="logo" />
0120                     {opendesktopLabel} : 
0121                   </a>
0122                   <a href={state.target.link} style={{paddingLeft:'0px',marginLeft:'0px'}}>
0123                     <span className="target">{ state.target.logoLabel }</span>
0124                   </a>                  
0125               </li>
0126               <li><a href={state.gitlabUrl + "/explore/projects"}>{opencodeLabel}</a></li>
0127               <li><a href={state.baseUrlStore}>{plingLabel}</a></li>              
0128             </>
0129           );
0130         break;
0131     }
0132   }else{
0133     dT =(
0134       <>
0135         <li className={cls}>
0136           <a id="opendesktop-logo" href={state.baseUrl}>
0137             <img src={state.baseUrl + "/images/system/ocs-logo-rounded-16x16.png"} className="logo" />
0138             {opendesktopLabel} 
0139           </a>
0140         </li>        
0141         <li><a href={state.gitlabUrl + "/explore/projects"}>{opencodeLabel}</a></li>
0142         <li><a href={state.baseUrlStore}>{plingLabel}</a></li>
0143       </>
0144     );
0145   }
0146 
0147   return (
0148     <ul className="metaheader-menu left" id="domains-menu">
0149         {dT}
0150         {moreMenuItemDisplay}
0151       </ul>
0152   )
0153 }
0154 
0155 export default DomainsMenu
0156