mirror of
https://github.com/status-im/fathom.git
synced 2025-03-01 03:20:27 +00:00
don't show site switcher if there's only 1 site with no option to add more
This commit is contained in:
parent
41331598b9
commit
adb26ad32f
@ -32,15 +32,18 @@ class SiteSwitcher extends Component {
|
||||
}
|
||||
|
||||
render(props, state) {
|
||||
let siteNodes = props.sites.map((s) => (<li class="site-switch"><a href="javascript:void(0);" data-id={s.id} onClick={this.selectSite}>{s.name}</a></li>))
|
||||
let addSiteNode = props.showAdd ? (<li class="add-new"><a href="javascript:void(0);" onClick={this.addSite}>+ Add another site</a></li>) : '';
|
||||
// show nothing if there is only 1 site and no option to add additional sites
|
||||
if(!props.showAdd && props.sites.length == 1) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// otherwise, render list of sites + add button
|
||||
return (
|
||||
<li class="sites">
|
||||
<a href="javascript:void(0)">{props.selectedSite.name}</a>
|
||||
<ul>
|
||||
{siteNodes}
|
||||
{addSiteNode}
|
||||
{props.sites.map((s) => (<li class="site-switch"><a href="javascript:void(0);" data-id={s.id} onClick={this.selectSite}>{s.name}</a></li>)) }
|
||||
{props.showAdd ? (<li class="add-new"><a href="javascript:void(0);" onClick={this.addSite}>+ Add another site</a></li>) : ''}
|
||||
</ul>
|
||||
</li>
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user