Removing sorting of search uris in favor of source selection dropdown
This commit is contained in:
@ -319,13 +319,20 @@ class Search extends React.Component{
|
||||
{
|
||||
value: 'duration',
|
||||
label: 'Duration'
|
||||
},
|
||||
{
|
||||
value: 'uri',
|
||||
label: 'Source'
|
||||
}
|
||||
];
|
||||
|
||||
var provider_options = [{
|
||||
value: 'all',
|
||||
label: 'All'
|
||||
}];
|
||||
for (var i = 0; i < this.props.uri_schemes.length; i++){
|
||||
provider_options.push({
|
||||
value: this.props.uri_schemes[i],
|
||||
label: helpers.titleCase(this.props.uri_schemes[i].replace(':','').replace('+',' '))
|
||||
});
|
||||
}
|
||||
|
||||
var options = (
|
||||
<span>
|
||||
<DropdownField
|
||||
@ -334,13 +341,16 @@ class Search extends React.Component{
|
||||
value={this.props.sort}
|
||||
options={sort_options}
|
||||
reverse={this.props.sort_reverse}
|
||||
handleChange={val => {this.setSort(val); this.props.uiActions.hideContextMenu() }} />
|
||||
|
||||
<button className="no-hover" onClick={e => this.props.uiActions.openModal('search_uri_schemes', {query: this.props.params.query})}>
|
||||
<FontAwesome name="wrench" />
|
||||
Sources
|
||||
</button>
|
||||
|
||||
handleChange={value => {this.setSort(value); this.props.uiActions.hideContextMenu()}}
|
||||
/>
|
||||
<DropdownField
|
||||
icon="database"
|
||||
name="Source"
|
||||
value={this.props.search_uri_schemes}
|
||||
options={provider_options}
|
||||
reverse={this.props.sort_reverse}
|
||||
handleChange={value => {this.props.uiActions.set({search_uri_schemes: value}); this.props.uiActions.hideContextMenu()}}
|
||||
/>
|
||||
</span>
|
||||
)
|
||||
|
||||
@ -354,7 +364,8 @@ class Search extends React.Component{
|
||||
|
||||
<SearchForm
|
||||
query={(this.props.params.query ? this.props.params.query : '')}
|
||||
view={(this.props.params.view ? this.props.params.view : 'all')} />
|
||||
view={(this.props.params.view ? this.props.params.view : 'all')}
|
||||
/>
|
||||
|
||||
<div className="content-wrapper">
|
||||
{ this.renderResults() }
|
||||
@ -372,6 +383,7 @@ const mapStateToProps = (state, ownProps) => {
|
||||
playlists: (state.core.playlists ? state.core.playlists : []),
|
||||
tracks: (state.core.tracks ? state.core.tracks : []),
|
||||
search_uri_schemes: (state.ui.search_uri_schemes ? state.ui.search_uri_schemes : []),
|
||||
uri_schemes: (state.mopidy.uri_schemes ? state.mopidy.uri_schemes : []),
|
||||
mopidy_search_results: (state.mopidy.search_results ? state.mopidy.search_results : {}),
|
||||
spotify_search_results: (state.spotify.search_results ? state.spotify.search_results : {}),
|
||||
sort: (state.ui.search_results_sort ? state.ui.search_results_sort : 'name'),
|
||||
|
||||
@ -249,9 +249,28 @@ class LibraryAlbums extends React.Component{
|
||||
var options = (
|
||||
<span>
|
||||
<FilterField handleChange={value => this.setState({filter: value, limit: this.state.per_page})} />
|
||||
<DropdownField icon="sort" name="Sort" value={this.props.sort} options={sort_options} reverse={this.props.sort_reverse} handleChange={val => {this.setSort(val); this.props.uiActions.hideContextMenu() }} />
|
||||
<DropdownField icon="eye" name="View" value={this.props.view} options={view_options} handleChange={val => {this.props.uiActions.set({ library_albums_view: val }); this.props.uiActions.hideContextMenu() }} />
|
||||
<DropdownField icon="database" name="Source" value={this.props.source} options={source_options} handleChange={val => {this.props.uiActions.set({ library_albums_source: val}); this.props.uiActions.hideContextMenu() }} />
|
||||
<DropdownField
|
||||
icon="sort"
|
||||
name="Sort"
|
||||
value={this.props.sort}
|
||||
options={sort_options}
|
||||
reverse={this.props.sort_reverse}
|
||||
handleChange={val => {this.setSort(val); this.props.uiActions.hideContextMenu() }}
|
||||
/>
|
||||
<DropdownField
|
||||
icon="eye"
|
||||
name="View"
|
||||
value={this.props.view}
|
||||
options={view_options}
|
||||
handleChange={val => {this.props.uiActions.set({ library_albums_view: val }); this.props.uiActions.hideContextMenu() }}
|
||||
/>
|
||||
<DropdownField
|
||||
icon="database"
|
||||
name="Source"
|
||||
value={this.props.source}
|
||||
options={source_options}
|
||||
handleChange={val => {this.props.uiActions.set({ library_albums_source: val}); this.props.uiActions.hideContextMenu() }}
|
||||
/>
|
||||
</span>
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user