Context menu trigger; Unified context menu

This commit is contained in:
James Barnsley
2017-02-28 16:13:27 +13:00
parent 8d93a21c83
commit 56782931bc
20 changed files with 244 additions and 257 deletions

View File

@ -13,6 +13,7 @@ import ConfirmationButton from '../components/ConfirmationButton'
import LazyLoadListener from '../components/LazyLoadListener'
import FollowButton from '../components/FollowButton'
import SidebarToggleButton from '../components/SidebarToggleButton'
import ContextMenuTrigger from '../components/ContextMenuTrigger'
import * as helpers from '../helpers'
import * as uiActions from '../services/ui/actions'
@ -43,7 +44,7 @@ class Playlist extends React.Component{
var data = {
e: e,
context: (this.props.playlist.can_edit ? 'editable-playlist' : 'playlist'),
item: this.props.playlist,
items: [this.props.playlist],
uris: [this.props.params.uri]
}
this.props.uiActions.showContextMenu(data)
@ -107,7 +108,7 @@ class Playlist extends React.Component{
<div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button>
<button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.playlist.uri, name: this.props.playlist.name }) }>Edit</button>
<button className="context-menu-trigger" onClick={e => this.handleContextMenu(e)}><FontAwesome name="ellipsis-v" /></button>
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div>
)
@ -117,7 +118,7 @@ class Playlist extends React.Component{
<div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button>
<button className="secondary" onClick={ e => this.props.uiActions.openModal('edit_playlist', { uri: this.props.playlist.uri, name: this.props.playlist.name, is_public: this.props.playlist.public }) }>Edit</button>
<button className="context-menu-trigger" onClick={e => this.handleContextMenu(e)}><FontAwesome name="ellipsis-v" /></button>
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div>
)
}
@ -125,7 +126,7 @@ class Playlist extends React.Component{
<div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button>
<FollowButton className="secondary" uri={this.props.playlist.uri} addText="Add to library" removeText="Remove from library" is_following={this.props.playlist.is_following} />
<button className="context-menu-trigger" onClick={e => this.handleContextMenu(e)}><FontAwesome name="ellipsis-v" /></button>
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div>
)
@ -133,7 +134,7 @@ class Playlist extends React.Component{
return (
<div className="actions">
<button className="primary" onClick={ e => this.play() }>Play</button>
<button className="context-menu-trigger" onClick={e => this.handleContextMenu(e)}><FontAwesome name="ellipsis-v" /></button>
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div>
)
}