Radio on Queue; Context menu extremities
This commit is contained in:
@ -128,13 +128,11 @@ class ContextMenu extends React.Component{
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
renderItems(trigger){
|
getItems(trigger){
|
||||||
var items = []
|
switch (this.props.context_menu.context) {
|
||||||
|
|
||||||
switch( this.props.context_menu.context ){
|
|
||||||
|
|
||||||
case 'queue':
|
case 'queue':
|
||||||
items = [
|
var items = [
|
||||||
{ handleClick: 'playQueueItem', label: 'Play', icon: 'play' },
|
{ handleClick: 'playQueueItem', label: 'Play', icon: 'play' },
|
||||||
{ handleClick: 'addToPlaylist', label: 'Add to playlist', icon: 'plus', playlists: true },
|
{ handleClick: 'addToPlaylist', label: 'Add to playlist', icon: 'plus', playlists: true },
|
||||||
{ handleClick: 'copyURIs', label: 'Copy URIs', icon: 'copy' },
|
{ handleClick: 'copyURIs', label: 'Copy URIs', icon: 'copy' },
|
||||||
@ -143,7 +141,7 @@ class ContextMenu extends React.Component{
|
|||||||
break
|
break
|
||||||
|
|
||||||
case 'editable-playlist':
|
case 'editable-playlist':
|
||||||
items = [
|
var items = [
|
||||||
{ handleClick: 'playItems', label: 'Play', icon: 'play' },
|
{ handleClick: 'playItems', label: 'Play', icon: 'play' },
|
||||||
{ handleClick: 'playItemsNext', label: 'Play next', icon: 'play' },
|
{ handleClick: 'playItemsNext', label: 'Play next', icon: 'play' },
|
||||||
{ handleClick: 'addToQueue', label: 'Add to queue', icon: 'plus' },
|
{ handleClick: 'addToQueue', label: 'Add to queue', icon: 'plus' },
|
||||||
@ -154,7 +152,7 @@ class ContextMenu extends React.Component{
|
|||||||
break
|
break
|
||||||
|
|
||||||
default:
|
default:
|
||||||
items = [
|
var items = [
|
||||||
{ handleClick: 'playItems', label: 'Play', icon: 'play' },
|
{ handleClick: 'playItems', label: 'Play', icon: 'play' },
|
||||||
{ handleClick: 'playItemsNext', label: 'Play next', icon: 'play' },
|
{ handleClick: 'playItemsNext', label: 'Play next', icon: 'play' },
|
||||||
{ handleClick: 'addToQueue', label: 'Add to queue', icon: 'plus' },
|
{ handleClick: 'addToQueue', label: 'Add to queue', icon: 'plus' },
|
||||||
@ -164,6 +162,12 @@ class ContextMenu extends React.Component{
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return items
|
||||||
|
}
|
||||||
|
|
||||||
|
renderItems(trigger){
|
||||||
|
var items = this.getItems(trigger)
|
||||||
|
|
||||||
var closeItem = (
|
var closeItem = (
|
||||||
<span className="menu-item-wrapper cancel">
|
<span className="menu-item-wrapper cancel">
|
||||||
<a className="menu-item" onClick={ (e) => this.closeAndDeselectTracks(e) }>
|
<a className="menu-item" onClick={ (e) => this.closeAndDeselectTracks(e) }>
|
||||||
@ -222,8 +226,18 @@ class ContextMenu extends React.Component{
|
|||||||
className += ' '+this.props.context_menu.trigger
|
className += ' '+this.props.context_menu.trigger
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var items = this.getItems(trigger)
|
||||||
|
var height = 0
|
||||||
|
if (items) height = items.length * 34
|
||||||
|
|
||||||
|
console.log(style.top, height)
|
||||||
|
|
||||||
if (this.props.context_menu.position_x > (window.innerWidth - 154)) className += ' right-align'
|
if (this.props.context_menu.position_x > (window.innerWidth - 154)) className += ' right-align'
|
||||||
if (this.props.context_menu.position_x > (window.innerWidth - 308)) className += ' right-align-submenu'
|
if (this.props.context_menu.position_x > (window.innerWidth - 308)) className += ' right-align-submenu'
|
||||||
|
if (this.props.context_menu.position_y > (window.innerHeight - height)){
|
||||||
|
style.top = style.top - height
|
||||||
|
className += ' bottom-align-submenu'
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={className} style={style}>
|
<div className={className} style={style}>
|
||||||
|
|||||||
@ -12,7 +12,7 @@ const localstorageMiddleware = (function(){
|
|||||||
|
|
||||||
// append our state to a global variable. This gives us access to debug the store at any point
|
// append our state to a global variable. This gives us access to debug the store at any point
|
||||||
window._store = store
|
window._store = store
|
||||||
console.log(action)
|
//console.log(action)
|
||||||
|
|
||||||
switch( action.type ){
|
switch( action.type ){
|
||||||
|
|
||||||
|
|||||||
@ -211,7 +211,6 @@ const MopidyMiddleware = (function(){
|
|||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// send an instruction to the websocket
|
|
||||||
case 'MOPIDY_URISCHEMES':
|
case 'MOPIDY_URISCHEMES':
|
||||||
var uri_schemes = action.data
|
var uri_schemes = action.data
|
||||||
var remove = ['http','https','mms','rtmp','rtmps','rtsp','sc','spotify']
|
var remove = ['http','https','mms','rtmp','rtmps','rtsp','sc','spotify']
|
||||||
@ -250,12 +249,17 @@ const MopidyMiddleware = (function(){
|
|||||||
|
|
||||||
case 'MOPIDY_PLAY_URIS':
|
case 'MOPIDY_PLAY_URIS':
|
||||||
|
|
||||||
|
// stop the radio
|
||||||
|
if (store.getState().ui.radio && store.getState().ui.radio.enabled){
|
||||||
|
store.dispatch( pusherActions.stopRadio() )
|
||||||
|
}
|
||||||
|
|
||||||
// add our first track
|
// add our first track
|
||||||
instruct( socket, store, 'tracklist.add', { uri: action.uris[0], at_position: 0 } )
|
instruct( socket, store, 'tracklist.add', { uri: action.uris[0], at_position: 0 } )
|
||||||
.then( response => {
|
.then( response => {
|
||||||
|
|
||||||
if( !response || response.length <= 0 ){
|
if( !response || response.length <= 0 ){
|
||||||
console.error('Could not add URI to tracklist', action.uris[0])
|
store.dispatch( uiActions.createNotification('Could not add URI(s) to tracklist', 'error') )
|
||||||
}else{
|
}else{
|
||||||
// play it
|
// play it
|
||||||
store.dispatch( mopidyActions.changeTrack( response[0].tlid ) );
|
store.dispatch( mopidyActions.changeTrack( response[0].tlid ) );
|
||||||
|
|||||||
@ -190,6 +190,7 @@ const PusherMiddleware = (function(){
|
|||||||
break
|
break
|
||||||
|
|
||||||
case 'PUSHER_STOP_RADIO':
|
case 'PUSHER_STOP_RADIO':
|
||||||
|
store.dispatch( uiActions.createNotification('Stopping radio') )
|
||||||
var data = {
|
var data = {
|
||||||
action: 'stop_radio',
|
action: 'stop_radio',
|
||||||
seed_artists: [],
|
seed_artists: [],
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
import React, { PropTypes } from 'react'
|
import React, { PropTypes } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { bindActionCreators } from 'redux'
|
import { bindActionCreators } from 'redux'
|
||||||
|
|
||||||
import FontAwesome from 'react-fontawesome'
|
import FontAwesome from 'react-fontawesome'
|
||||||
|
|
||||||
import TrackList from '../components/TrackList'
|
import TrackList from '../components/TrackList'
|
||||||
import Track from '../components/Track'
|
import Track from '../components/Track'
|
||||||
import SidebarToggleButton from '../components/SidebarToggleButton'
|
import SidebarToggleButton from '../components/SidebarToggleButton'
|
||||||
@ -45,10 +45,15 @@ class Queue extends React.Component{
|
|||||||
renderRadio(){
|
renderRadio(){
|
||||||
if (!this.props.radio || !this.props.radio.enabled) return null
|
if (!this.props.radio || !this.props.radio.enabled) return null
|
||||||
|
|
||||||
|
var seed_sentence = 'nothing'
|
||||||
|
if (this.props.radio.seed_artists.length > 0) seed_sentence = this.props.radio.seed_artists.length+' artists'
|
||||||
|
if (this.props.radio.seed_genres.length > 0) seed_sentence =this.props.radio.seed_artists.length+' genres'
|
||||||
|
if (this.props.radio.seed_tracks.length > 0) seed_sentence =this.props.radio.seed_artists.length+' tracks'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="radio">
|
<div className="radio">
|
||||||
Playing radio
|
Playing radio based on {seed_sentence}
|
||||||
<a onClick={ e => this.props.pusherActions.stopRadio() }>Stop radio</a>
|
<a className="text-button destructive pull-right" onClick={ e => this.props.pusherActions.stopRadio() }><FontAwesome name="close" /> Stop radio</a>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,11 @@
|
|||||||
right: 140px !important;
|
right: 140px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.bottom-align-submenu .submenu {
|
||||||
|
top: auto !important;
|
||||||
|
bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
.menu-item-wrapper {
|
.menu-item-wrapper {
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@ -56,7 +56,7 @@
|
|||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
width: 200px;
|
width: 220px;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
z-index: 97;
|
z-index: 97;
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
|
|||||||
@ -22,6 +22,14 @@ input[type="date"] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.text-button {
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&.destructive {
|
||||||
|
color: $red;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.button,
|
.button,
|
||||||
button,
|
button,
|
||||||
input[type="button"],
|
input[type="button"],
|
||||||
|
|||||||
@ -41,4 +41,12 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.radio {
|
||||||
|
margin: 20px auto 0;
|
||||||
|
padding: 10px 12px;
|
||||||
|
max-width: 400px;
|
||||||
|
background: $faint_grey;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user