Buttons on white; Added by in mobile context, fixes #342

This commit is contained in:
James Barnsley
2018-12-07 11:31:29 +13:00
parent 5ad32435a3
commit fa572a1742
14 changed files with 13996 additions and 10691 deletions

View File

@ -1,21 +1,22 @@
import React, { PropTypes } from 'react'
import { hashHistory } from 'react-router'
import Link from './Link'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import React, { PropTypes } from 'react';
import { hashHistory } from 'react-router';
import Link from './Link';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import TrackList from './TrackList'
import Icon from './Icon'
import Thumbnail from './Thumbnail'
import TrackList from './TrackList';
import Icon from './Icon';
import Thumbnail from './Thumbnail';
import URILink from './URILink';
import * as helpers from '../helpers'
import * as coreActions from '../services/core/actions'
import * as uiActions from '../services/ui/actions'
import * as pusherActions from '../services/pusher/actions'
import * as mopidyActions from '../services/mopidy/actions'
import * as lastfmActions from '../services/lastfm/actions'
import * as spotifyActions from '../services/spotify/actions'
import * as helpers from '../helpers';
import * as coreActions from '../services/core/actions';
import * as uiActions from '../services/ui/actions';
import * as pusherActions from '../services/pusher/actions';
import * as mopidyActions from '../services/mopidy/actions';
import * as lastfmActions from '../services/lastfm/actions';
import * as spotifyActions from '../services/spotify/actions';
class ContextMenu extends React.Component{
@ -315,13 +316,7 @@ class ContextMenu extends React.Component{
this.props.uiActions.hideContextMenu()
}
closeAndDeselectTracks(e){
this.props.uiActions.hideContextMenu();
// TODO
}
renderTitle(){
var context = this.getContext()
if (context.items_count > 1){
@ -334,6 +329,41 @@ class ContextMenu extends React.Component{
)
}
if (context.items_count == 1 && context.item !== undefined){
if (this.props.queue_metadata["tlid_"+context.item.tlid] !== undefined){
var metadata = this.props.queue_metadata["tlid_"+context.item.tlid];
if (metadata.added_from && metadata.added_by){
var type = (metadata.added_from ? helpers.uriType(metadata.added_from) : null);
switch (type){
case "discover":
var link = <URILink type="recommendations" uri={helpers.getFromUri('seeds',metadata.added_from)}>discover</URILink>
break;
case "browse":
var link = <URILink type="browse" uri={metadata.added_from.replace("iris:browse:","")}>browse</URILink>
break;
case "search":
var link = <URILink type="search" uri={metadata.added_from.replace("iris:","")}>search</URILink>
break;
default:
var link = <URILink type={type} uri={metadata.added_from}>{type}</URILink>;
}
return (
<div className="context-menu__title">
<div className="context-menu__title__text">
{metadata.added_by} added from {link}
</div>
</div>
)
}
}
}
if (context.name == 'custom'){
if (!this.props.menu.title){
return null;
@ -347,40 +377,6 @@ class ContextMenu extends React.Component{
</div>
)
}
// Do we need titles or does it just confuse things and rip off Spotify too hard?
return null;
/*
switch (context.type){
case 'artist':
case 'album':
case 'playlist':
var style = null;
return (
<div className="context-menu__title">
<Thumbnail size="small" images={context.item ? context.item.images : null} circle={context.type == 'artist'} />
<div className="context-menu__title__text">{context.item.name}</div>
<div className="context-menu__title__type">
{context.source}
</div>
</div>
);
default:
return (
<div className="context-menu__title">
<div className="context-menu__title__text">
{context.items_count} {context.nice_name}{context.items_count > 1 ? 's' : null}
</div>
<div className="context-menu__title__type">
{context.source}
</div>
</div>
);
}*/
}
setSubmenu(name){
@ -821,6 +817,7 @@ const mapStateToProps = (state, ownProps) => {
processes: state.ui.processes,
current_track: state.core.current_track,
current_tracklist: state.core.current_tracklist,
queue_metadata: state.core.queue_metadata,
spotify_library_playlists: state.spotify.library_playlists,
spotify_library_playlists_loaded_all: state.spotify.library_playlists_loaded_all,
mopidy_library_playlists: state.mopidy.library_playlists,

View File

@ -137,7 +137,7 @@ class Playlist extends React.Component{
return (
<div className="actions">
<button className="button button--primary" onClick={ e => this.play() }>Play</button>
<Link className="button button--secondary" to={global.baseURL+'playlist/'+encodeURIComponent(this.props.params.uri)+'/edit'}>Edit</Link>
<Link className="button" to={global.baseURL+'playlist/'+encodeURIComponent(this.props.params.uri)+'/edit'}>Edit</Link>
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div>
)
@ -147,7 +147,7 @@ class Playlist extends React.Component{
return (
<div className="actions">
<button className="button button--primary" onClick={ e => this.play() }>Play</button>
<Link className="button button--secondary" to={global.baseURL+'playlist/'+encodeURIComponent(this.props.params.uri)+'/edit'}>Edit</Link>
<Link className="button" to={global.baseURL+'playlist/'+encodeURIComponent(this.props.params.uri)+'/edit'}>Edit</Link>
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div>
)
@ -155,7 +155,7 @@ class Playlist extends React.Component{
return (
<div className="actions">
<button className="button button--primary" onClick={ e => this.play() }>Play</button>
<FollowButton className="button--secondary" uri={this.props.params.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} />
<FollowButton uri={this.props.params.uri} addText="Add to library" removeText="Remove from library" is_following={this.inLibrary()} />
<ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />
</div>
)

View File

@ -421,7 +421,7 @@ class Settings extends React.Component {
</div>
<div className="field">
{this.props.pusher.version.upgrade_available ? <button className="button button--alternative" onClick={e => this.props.pusherActions.upgrade()}>Upgrade to { this.props.pusher.version.latest }</button> : null }
{this.props.pusher.version.upgrade_available ? <button className="button button--secondary" onClick={e => this.props.pusherActions.upgrade()}>Upgrade to { this.props.pusher.version.latest }</button> : null }
<button className={"button button--destructive"+(this.props.mopidy.restarting ? ' button--working' : '')} onClick={e => this.props.pusherActions.restart()}>Restart server</button>
<ConfirmationButton className="button--destructive" content="Reset all settings" confirmingContent="Are you sure?" onConfirm={() => this.resetAllSettings()} />
</div>

View File

@ -105,7 +105,7 @@ class Discover extends React.Component{
}
},
popularity: {
enabled: true,
enabled: false,
min: 0,
max: 100,
value: {
@ -479,7 +479,7 @@ class Discover extends React.Component{
<br />
<section>
<h4>Albums</h4>
<AlbumGrid className="mini" albums={albums} />
<AlbumGrid className="grid--mini" albums={albums} />
</section>
</div>

View File

@ -174,10 +174,10 @@ class LibraryBrowse extends React.Component{
options={view_options}
handleChange={value => {this.props.uiActions.set({ library_directory_view: value }); this.props.uiActions.hideContextMenu()}}
/>
{tracks ? <a className="button no-hover" onClick={e => {this.props.uiActions.hideContextMenu(); this.playAll(e, tracks)}}>
{tracks ? <a className="button button--no-hover" onClick={e => {this.props.uiActions.hideContextMenu(); this.playAll(e, tracks)}}>
<Icon name="play_circle_filled" />Play all
</a> : null }
<a className="button no-hover" onClick={e => {this.props.uiActions.hideContextMenu(); this.goBack(e)}}>
<a className="button button--no-hover" onClick={e => {this.props.uiActions.hideContextMenu(); this.goBack(e)}}>
<Icon name="keyboard_backspace" />Back
</a>
</span>

View File

@ -242,7 +242,7 @@ class LibraryPlaylists extends React.Component{
options={source_options}
handleChange={value => {this.props.uiActions.set({ library_playlists_source: value}); this.props.uiActions.hideContextMenu() }}
/>
<Link className="button no-hover" to={global.baseURL+'playlist/create'}>
<Link className="button button--no-hover" to={global.baseURL+'playlist/create'}>
<Icon name="add_box" />New
</Link>
</span>