Slim mode now defined at global js, no need for store usage
This commit is contained in:
@ -104,7 +104,7 @@ class App extends React.Component{
|
||||
global.slim_mode = true
|
||||
}
|
||||
} else {
|
||||
if (this.props.slim_mode){
|
||||
if (global.slim_mode){
|
||||
global.slim_mode = false
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ class App extends React.Component{
|
||||
if (this.props.sidebar_open) className += ' sidebar-open'
|
||||
if (this.props.modal) className += ' modal-open'
|
||||
if (this.props.touch_dragging) className += ' touch-dragging'
|
||||
if (this.props.slim_mode) className += ' slim-mode'
|
||||
if (global.slim_mode) className += ' slim-mode'
|
||||
if (helpers.isTouchDevice()){
|
||||
className += ' touch'
|
||||
} else {
|
||||
@ -254,7 +254,6 @@ class App extends React.Component{
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
touch_dragging: state.ui.touch_dragging,
|
||||
slim_mode: state.ui.slim_mode,
|
||||
broadcasts: (state.ui.broadcasts ? state.ui.broadcasts : []),
|
||||
volume: (state.mopidy.volume ? state.mopidy.volume : false),
|
||||
notifications: (state.ui.notifications ? state.ui.notifications : []),
|
||||
|
||||
@ -214,7 +214,7 @@ export default class Track extends React.Component{
|
||||
)
|
||||
}
|
||||
|
||||
if (this.props.slim_mode){
|
||||
if (global.slim_mode){
|
||||
|
||||
// Select zone handles selection events only
|
||||
// We use onClick to capture touch as well as mouse events in one tidy parcel
|
||||
|
||||
@ -191,7 +191,7 @@ class TrackList extends React.Component{
|
||||
handleSelection(e,track_key){
|
||||
let selected_tracks = this.props.selected_tracks
|
||||
|
||||
if (e.ctrlKey || this.props.slim_mode){
|
||||
if (e.ctrlKey || global.slim_mode){
|
||||
|
||||
// Already selected, so unselect it
|
||||
if (selected_tracks.includes(track_key)){
|
||||
@ -398,7 +398,6 @@ class TrackList extends React.Component{
|
||||
track={track}
|
||||
context={this.props.context}
|
||||
can_sort={this.props.context == 'queue' || this.props.context == 'editable-playlist'}
|
||||
slim_mode={this.props.slim_mode}
|
||||
selected={this.props.selected_tracks.includes(track_key)}
|
||||
dragger={this.props.dragger}
|
||||
handleSelection={e => this.handleSelection(e, track_key)}
|
||||
@ -428,7 +427,6 @@ class TrackList extends React.Component{
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
selected_tracks: state.ui.selected_tracks,
|
||||
slim_mode: state.ui.slim_mode,
|
||||
dragger: state.ui.dragger,
|
||||
current_track: state.core.current_track,
|
||||
context_menu: state.ui.context_menu
|
||||
|
||||
@ -122,7 +122,7 @@ class Album extends React.Component{
|
||||
return (
|
||||
<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}
|
||||
{global.slim_mode ? <Header icon="cd" title="Album" handleContextMenuTrigger={e => this.handleContextMenu(e)} uiActions={this.props.uiActions} /> : null}
|
||||
|
||||
<div className="thumbnail-wrapper">
|
||||
<Thumbnail size="large" canZoom images={ this.props.album.images } />
|
||||
@ -133,8 +133,8 @@ class Album extends React.Component{
|
||||
<h1>{ this.props.album.name }</h1>
|
||||
|
||||
<ul className="details">
|
||||
{ !this.props.slim_mode ? <li className="has-tooltip"><FontAwesome name={helpers.sourceIcon( this.props.params.uri )} /><span className="tooltip">{helpers.uriSource( this.props.params.uri )} {this.props.album.album_type ? this.props.album.album_type : 'album'}</span></li> : null }
|
||||
{ !this.props.slim_mode && artists.length > 0 ? <li><ArtistSentence artists={artists} /></li> : null }
|
||||
{ !global.slim_mode ? <li className="has-tooltip"><FontAwesome name={helpers.sourceIcon( this.props.params.uri )} /><span className="tooltip">{helpers.uriSource( this.props.params.uri )} {this.props.album.album_type ? this.props.album.album_type : 'album'}</span></li> : null }
|
||||
{ !global.slim_mode && artists.length > 0 ? <li><ArtistSentence artists={artists} /></li> : null }
|
||||
{ this.props.album.release_date ? <li><Dater type="date" data={ this.props.album.release_date } /></li> : null }
|
||||
<li>
|
||||
{ this.props.album.tracks_total ? this.props.album.tracks_total : '0' } tracks,
|
||||
@ -146,7 +146,7 @@ class Album extends React.Component{
|
||||
<div className="actions">
|
||||
<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 }
|
||||
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
{global.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
</div>
|
||||
|
||||
<section className="list-wrapper">
|
||||
@ -168,7 +168,6 @@ class Album extends React.Component{
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
slim_mode: state.ui.slim_mode,
|
||||
load_queue: state.ui.load_queue,
|
||||
artists: state.core.artists,
|
||||
album: (state.core.albums && typeof(state.core.albums[ownProps.params.uri]) !== 'undefined' ? state.core.albums[ownProps.params.uri] : false ),
|
||||
|
||||
@ -203,7 +203,7 @@ class Artist extends React.Component{
|
||||
return (
|
||||
<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}
|
||||
{global.slim_mode ? <Header className="overlay" icon="mic" title="Artist" handleContextMenuTrigger={e => this.handleContextMenu(e)} uiActions={this.props.uiActions} /> : null}
|
||||
|
||||
<div className="intro">
|
||||
|
||||
@ -214,7 +214,7 @@ class Artist extends React.Component{
|
||||
<div className="actions">
|
||||
{ can_play_radio ? <button className="primary" onClick={e => this.props.pusherActions.startRadio([this.props.artist.uri])}>Start radio</button> : <button className="primary" onClick={e => this.props.mopidyActions.playURIs(this.props.artist.albums_uris, this.props.artist.uri)}>Play all</button>}
|
||||
{ can_follow ? <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)} />}
|
||||
{global.slim_mode ? null : <ContextMenuTrigger className="white" onTrigger={e => this.handleContextMenu(e)} />}
|
||||
</div>
|
||||
{ this.renderSubViewMenu() }
|
||||
</div>
|
||||
@ -260,7 +260,6 @@ class Artist extends React.Component{
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
slim_mode: state.ui.slim_mode,
|
||||
load_queue: state.ui.load_queue,
|
||||
artist: (state.core.artists && typeof(state.core.artists[ownProps.params.uri]) !== 'undefined' ? state.core.artists[ownProps.params.uri] : false ),
|
||||
artists: (state.core.artists ? state.core.artists : []),
|
||||
|
||||
@ -117,7 +117,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.params.uri, name: this.props.playlist.name }) }>Edit</button>
|
||||
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
{global.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -127,7 +127,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.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)} />}
|
||||
{global.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -135,7 +135,7 @@ class Playlist extends React.Component{
|
||||
<div className="actions">
|
||||
<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()} />
|
||||
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
{global.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
</div>
|
||||
)
|
||||
|
||||
@ -143,7 +143,7 @@ class Playlist extends React.Component{
|
||||
return (
|
||||
<div className="actions">
|
||||
<button className="primary" onClick={ e => this.play() }>Play</button>
|
||||
{this.props.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
{global.slim_mode ? null : <ContextMenuTrigger onTrigger={e => this.handleContextMenu(e)} />}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@ -169,7 +169,7 @@ class Playlist extends React.Component{
|
||||
return (
|
||||
<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}
|
||||
{global.slim_mode ? <Header icon="playlist" title="Playlist" handleContextMenuTrigger={e => this.handleContextMenu(e)} uiActions={this.props.uiActions} /> : null}
|
||||
|
||||
<div className="thumbnail-wrapper">
|
||||
<Thumbnail size="large" canZoom images={ this.props.playlist.images } />
|
||||
@ -180,8 +180,8 @@ class Playlist extends React.Component{
|
||||
{ this.props.playlist.description ? <h2 className="description grey-text" dangerouslySetInnerHTML={{__html: this.props.playlist.description}}></h2> : null }
|
||||
|
||||
<ul className="details">
|
||||
{ !this.props.slim_mode ? <li className="has-tooltip"><FontAwesome name={helpers.sourceIcon( this.props.params.uri )} /><span className="tooltip">{helpers.uriSource( this.props.params.uri )} playlist</span></li> : null }
|
||||
{ this.props.playlist.owner && !this.props.slim_mode ? <li><Link to={'/user/'+this.props.playlist.owner.uri}>{this.props.playlist.owner.id}</Link></li> : null }
|
||||
{ !global.slim_mode ? <li className="has-tooltip"><FontAwesome name={helpers.sourceIcon( this.props.params.uri )} /><span className="tooltip">{helpers.uriSource( this.props.params.uri )} playlist</span></li> : null }
|
||||
{ this.props.playlist.owner && !global.slim_mode ? <li><Link to={'/user/'+this.props.playlist.owner.uri}>{this.props.playlist.owner.id}</Link></li> : null }
|
||||
{ this.props.playlist.followers ? <li>{this.props.playlist.followers.total.toLocaleString()} followers</li> : null }
|
||||
{ this.props.playlist.last_modified ? <li><Dater type="ago" data={this.props.playlist.last_modified} /></li> : null }
|
||||
<li>
|
||||
@ -213,7 +213,6 @@ const mapStateToProps = (state, ownProps) => {
|
||||
var uri = ownProps.params.uri
|
||||
uri = uri.replace(' ','%20')
|
||||
return {
|
||||
slim_mode: state.ui.slim_mode,
|
||||
load_queue: state.ui.load_queue,
|
||||
playlist: (state.core.playlists && state.core.playlists[uri] !== undefined ? state.core.playlists[uri] : false ),
|
||||
spotify_library_playlists: state.spotify.library_playlists,
|
||||
|
||||
@ -117,7 +117,7 @@ class LibraryPlaylists extends React.Component{
|
||||
}
|
||||
|
||||
if (this.props.view == 'list'){
|
||||
if (this.props.slim_mode){
|
||||
if (global.slim_mode){
|
||||
var columns = [
|
||||
{
|
||||
label: 'Name',
|
||||
@ -262,7 +262,6 @@ const mapStateToProps = (state, ownProps) => {
|
||||
mopidy_library_playlists_status: state.mopidy.library_playlists_status,
|
||||
spotify_library_playlists: state.spotify.library_playlists,
|
||||
spotify_library_playlists_status: state.spotify.library_playlists_status,
|
||||
slim_mode: state.ui.slim_mode,
|
||||
load_queue: state.ui.load_queue,
|
||||
me_id: (state.spotify.me ? state.spotify.me.id : (state.ui.config && state.ui.config.spotify_username ? state.ui.config.spotify_username : false)),
|
||||
view: state.ui.library_playlists_view,
|
||||
|
||||
Reference in New Issue
Block a user