Removing context menu where not needed

This commit is contained in:
James Barnsley
2017-10-21 21:58:53 +13:00
parent e226925abe
commit 44eaaa332c
5 changed files with 18 additions and 16 deletions

View File

@ -32,6 +32,16 @@ export default class Header extends React.Component{
} }
} }
renderContextMenuTrigger(){
// No custom trigger, nor any options
if (!this.props.handleContextMenuTrigger && !this.props.options){
return null;
}
return <ContextMenuTrigger onTrigger={e => this.handleContextMenuTrigger(e,this.props.options)} />
}
renderOptions(){ renderOptions(){
if (!this.props.options && !this.props.handleContextMenuTrigger){ if (!this.props.options && !this.props.handleContextMenuTrigger){
return null; return null;
@ -39,7 +49,7 @@ export default class Header extends React.Component{
return ( return (
<div className='options'> <div className='options'>
<ContextMenuTrigger onTrigger={e => this.handleContextMenuTrigger(e,this.props.options)} /> {this.renderContextMenuTrigger()}
<span className="items"> <span className="items">
<span className="liner"> <span className="liner">
{this.props.options ? this.props.options : null} {this.props.options ? this.props.options : null}

View File

@ -121,9 +121,6 @@ class Album extends React.Component{
return ( return (
<div className="view album-view content-wrapper"> <div className="view album-view content-wrapper">
{this.props.slim_mode ? <Header icon="cd" title="Album" handleContextMenuTrigger={e => this.handleContextMenu(e)} uiActions={this.props.uiActions} /> : null}
<div className="thumbnail-wrapper"> <div className="thumbnail-wrapper">
<Thumbnail size="large" canZoom images={ this.props.album.images } /> <Thumbnail size="large" canZoom images={ this.props.album.images } />
</div> </div>
@ -146,7 +143,7 @@ class Album extends React.Component{
<div className="actions"> <div className="actions">
<button className="primary" onClick={e => this.play()}>Play</button> <button className="primary" onClick={e => this.play()}>Play</button>
{ helpers.uriSource(this.props.params.uri) == 'spotify' ? <FollowButton className="secondary" uri={this.props.params.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} /> : null } { helpers.uriSource(this.props.params.uri) == 'spotify' ? <FollowButton className="secondary" uri={this.props.params.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} /> : null }
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />} <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div> </div>
<section className="list-wrapper"> <section className="list-wrapper">

View File

@ -205,9 +205,6 @@ class Artist extends React.Component{
return ( return (
<div className="view artist-view"> <div className="view artist-view">
{this.props.slim_mode ? <Header className="overlay" icon="mic" title="Artist" handleContextMenuTrigger={e => this.handleContextMenu(e)} uiActions={this.props.uiActions} /> : null}
<div className="intro"> <div className="intro">
<Parallax image={image} /> <Parallax image={image} />
@ -217,7 +214,7 @@ class Artist extends React.Component{
<div className="actions"> <div className="actions">
<button className="primary" onClick={e => this.props.mopidyActions.playURIs(uris_to_play, this.props.artist.uri)}>Play</button> <button className="primary" onClick={e => this.props.mopidyActions.playURIs(uris_to_play, this.props.artist.uri)}>Play</button>
{is_spotify ? <FollowButton className="white" uri={this.props.params.uri} removeText="Remove from library" addText="Add to library" is_following={this.inLibrary()} /> : null} {is_spotify ? <FollowButton className="white" uri={this.props.params.uri} removeText="Remove from library" addText="Add to library" is_following={this.inLibrary()} /> : null}
{this.props.slim_mode ? null : <ContextMenuTrigger className="white" onTrigger={e => this.handleContextMenu(e)} />} <ContextMenuTrigger className="white" onTrigger={e => this.handleContextMenu(e)} />
</div> </div>
{ this.renderSubViewMenu() } { this.renderSubViewMenu() }
</div> </div>

View File

@ -117,7 +117,7 @@ class Playlist extends React.Component{
<div className="actions"> <div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button> <button className="primary" onClick={ e => this.play() }>Play</button>
<button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.params.uri, name: this.props.playlist.name }) }>Edit</button> <button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.params.uri, name: this.props.playlist.name }) }>Edit</button>
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />} <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div> </div>
) )
@ -127,7 +127,7 @@ class Playlist extends React.Component{
<div className="actions"> <div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button> <button className="primary" onClick={ e => this.play() }>Play</button>
<button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.params.uri, name: this.props.playlist.name, public: this.props.playlist.public, collaborative: this.props.playlist.collaborative, description: this.props.playlist.description }) }>Edit</button> <button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.params.uri, name: this.props.playlist.name, public: this.props.playlist.public, collaborative: this.props.playlist.collaborative, description: this.props.playlist.description }) }>Edit</button>
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />} <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div> </div>
) )
} }
@ -135,7 +135,7 @@ class Playlist extends React.Component{
<div className="actions"> <div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button> <button className="primary" onClick={ e => this.play() }>Play</button>
<FollowButton className="secondary" uri={this.props.params.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} /> <FollowButton className="secondary" uri={this.props.params.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} />
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />} <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div> </div>
) )
@ -143,7 +143,7 @@ class Playlist extends React.Component{
return ( return (
<div className="actions"> <div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button> <button className="primary" onClick={ e => this.play() }>Play</button>
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />} <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div> </div>
) )
} }
@ -168,9 +168,6 @@ class Playlist extends React.Component{
return ( return (
<div className="view playlist-view content-wrapper"> <div className="view playlist-view content-wrapper">
{this.props.slim_mode ? <Header icon="playlist" title="Playlist" handleContextMenuTrigger={e => this.handleContextMenu(e)} uiActions={this.props.uiActions} /> : null}
<div className="thumbnail-wrapper"> <div className="thumbnail-wrapper">
<Thumbnail size="large" canZoom images={ this.props.playlist.images } /> <Thumbnail size="large" canZoom images={ this.props.playlist.images } />
</div> </div>

View File

@ -127,6 +127,7 @@ aside{
.liner { .liner {
bottom: 0 !important; bottom: 0 !important;
padding-bottom: 30px;
} }
.thumbnail { .thumbnail {