Context menu slick + filter field sticky value

This commit is contained in:
James Barnsley
2018-11-16 13:52:45 +13:00
parent 958481ce85
commit 55c75729e6
13 changed files with 14059 additions and 10750 deletions

View File

@ -322,12 +322,19 @@ class ContextMenu extends React.Component{
}
renderTitle(){
// Do we need titles or does it just confuse things and rip off Spotify too hard?
return null;
var context = this.getContext()
if (context.items_count > 1){
return (
<div className="context-menu__title">
<div className="context-menu__title__text">
{context.items_count} {context.nice_name}{context.items_count > 1 ? 's' : null} selected
</div>
</div>
)
}
if (context.name == 'custom'){
if (!this.props.menu.title){
return null;
@ -341,7 +348,10 @@ 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':
@ -371,7 +381,7 @@ class ContextMenu extends React.Component{
</div>
);
}
}*/
}
setSubmenu(name){

View File

@ -17,11 +17,12 @@ export default class FilterField extends React.Component{
}
componentWillMount(){
window.addEventListener("keyup", this.handleKeyUp, false)
window.addEventListener("keyup", this.handleKeyUp, false);
this.setState({value: this.props.initialValue});
}
componentWillUnmount(){
window.removeEventListener("keyup", this.handleKeyUp, false)
window.removeEventListener("keyup", this.handleKeyUp, false);
}
handleKeyUp(e){
@ -59,7 +60,6 @@ export default class FilterField extends React.Component{
return (
<span className={"filter-field "+(this.state.active ? 'active' : '')} onClick={e => this.activate()}>
<form>
<Icon name="search" type="material" />
<input
type="text"
placeholder="Filter"
@ -68,6 +68,7 @@ export default class FilterField extends React.Component{
onBlur={e => this.handleBlur()}
onChange={e => this.handleChange(e.target.value)}
/>
<Icon name="search" type="material" />
</form>
</span>
)

View File

@ -591,7 +591,7 @@ export let formatUser = function(data){
user.images = formatImages(user.images);
}
if (data.followers && data.followers.total){
if (data.followers && data.followers.total !== undefined){
user.followers = data.followers.total;
}
if (data.realname){

View File

@ -310,7 +310,10 @@ class LibraryAlbums extends React.Component{
var options = (
<span>
<FilterField handleChange={value => this.setState({filter: value, limit: this.state.per_page})} />
<FilterField
initialValue={this.state.filter}
handleChange={value => this.setState({filter: value, limit: this.state.per_page})}
/>
<DropdownField
icon="sort"
name="Sort"

View File

@ -265,7 +265,10 @@ class LibraryArtists extends React.Component{
var options = (
<span>
<FilterField handleChange={value => this.setState({filter: value, limit: this.state.per_page})} />
<FilterField
initialValue={this.state.filter}
handleChange={value => this.setState({filter: value, limit: this.state.per_page})}
/>
<DropdownField
icon="sort"
name="Sort"

View File

@ -217,6 +217,7 @@ class LibraryPlaylists extends React.Component{
var options = (
<span>
<FilterField
initialValue={this.state.filter}
handleChange={value => this.setState({filter: value})}
/>
<DropdownField