Cleaning up header and filter alignment
This commit is contained in:
@ -18,7 +18,7 @@ import * as uiActions from '../../services/ui/actions';
|
||||
import * as mopidyActions from '../../services/mopidy/actions';
|
||||
import * as spotifyActions from '../../services/spotify/actions';
|
||||
|
||||
class LibraryPlaylists extends React.Component {
|
||||
class LibraryPlaylists extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
@ -29,7 +29,7 @@ class LibraryPlaylists extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
componentWillMount() {
|
||||
// Before we mount, restore any limit defined in our location state
|
||||
const state = (this.props.location.state ? this.props.location.state : {});
|
||||
if (state.limit) {
|
||||
@ -51,8 +51,8 @@ class LibraryPlaylists extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps) {
|
||||
if (newProps.mopidy_connected && (newProps.source == 'all' || newProps.source == 'local')) {
|
||||
componentWillReceiveProps(newProps) {
|
||||
if (newProps.mopidy_connected && (newProps.source == 'all' || newProps.source == 'local')) {
|
||||
// We've just connected
|
||||
if (!this.props.mopidy_connected) {
|
||||
this.props.mopidyActions.getLibraryPlaylists();
|
||||
@ -64,7 +64,7 @@ class LibraryPlaylists extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
if (newProps.spotify_enabled && (newProps.source == 'all' || newProps.source == 'spotify')) {
|
||||
if (newProps.spotify_enabled && (newProps.source == 'all' || newProps.source == 'spotify')) {
|
||||
// Filter changed, but we haven't got this provider's library yet
|
||||
if (newProps.spotify_library_playlists_status != 'finished' && newProps.spotify_library_playlists_status != 'started') {
|
||||
this.props.spotifyActions.getLibraryPlaylists();
|
||||
@ -150,12 +150,12 @@ class LibraryPlaylists extends React.Component {
|
||||
details={['owner', 'tracks_total']}
|
||||
right_column={['source']}
|
||||
className="playlists"
|
||||
link_prefix="/playlist/"
|
||||
link_prefix="/playlist/"
|
||||
/>
|
||||
<LazyLoadListener
|
||||
loadKey={total_playlists > this.state.limit ? this.state.limit : total_playlists}
|
||||
loading={this.state.limit < total_playlists}
|
||||
loadMore={() => this.loadMore()}
|
||||
loadMore={() => this.loadMore()}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
@ -164,15 +164,15 @@ class LibraryPlaylists extends React.Component {
|
||||
<section className="content-wrapper">
|
||||
<PlaylistGrid
|
||||
handleContextMenu={(e, item) => this.handleContextMenu(e, item)}
|
||||
playlists={playlists}
|
||||
playlists={playlists}
|
||||
/>
|
||||
<LazyLoadListener
|
||||
loadKey={total_playlists > this.state.limit ? this.state.limit : total_playlists}
|
||||
loading={this.state.limit < total_playlists}
|
||||
loadMore={() => this.loadMore()}
|
||||
loadMore={() => this.loadMore()}
|
||||
/>
|
||||
</section>
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
@ -236,7 +236,8 @@ class LibraryPlaylists extends React.Component {
|
||||
<span>
|
||||
<FilterField
|
||||
initialValue={this.state.filter}
|
||||
handleChange={(value) => this.setState({ filter: value })}
|
||||
handleChange={(value) => this.setState({ filter: value })}
|
||||
onSubmit={e => this.props.uiActions.hideContextMenu()}
|
||||
/>
|
||||
<DropdownField
|
||||
icon="sort"
|
||||
@ -244,25 +245,25 @@ class LibraryPlaylists extends React.Component {
|
||||
value={this.props.sort}
|
||||
options={sort_options}
|
||||
selected_icon={this.props.sort ? (this.props.sort_reverse ? 'keyboard_arrow_up' : 'keyboard_arrow_down') : null}
|
||||
handleChange={(value) => { this.setSort(value); this.props.uiActions.hideContextMenu(); }}
|
||||
handleChange={(value) => { this.setSort(value); this.props.uiActions.hideContextMenu(); }}
|
||||
/>
|
||||
<DropdownField
|
||||
icon="visibility"
|
||||
name="View"
|
||||
value={this.props.view}
|
||||
options={view_options}
|
||||
handleChange={(value) => { this.props.uiActions.set({ library_playlists_view: value }); this.props.uiActions.hideContextMenu(); }}
|
||||
handleChange={(value) => { this.props.uiActions.set({ library_playlists_view: value }); this.props.uiActions.hideContextMenu(); }}
|
||||
/>
|
||||
<DropdownField
|
||||
icon="cloud"
|
||||
name="Source"
|
||||
value={this.props.source}
|
||||
options={source_options}
|
||||
handleChange={(value) => { this.props.uiActions.set({ library_playlists_source: value }); this.props.uiActions.hideContextMenu(); }}
|
||||
handleChange={(value) => { this.props.uiActions.set({ library_playlists_source: value }); this.props.uiActions.hideContextMenu(); }}
|
||||
/>
|
||||
<Link className="button button--no-hover" to="/playlist/create">
|
||||
<Icon name="add_box" />
|
||||
New
|
||||
<Icon name="add_box" />
|
||||
New
|
||||
</Link>
|
||||
</span>
|
||||
);
|
||||
@ -304,4 +305,4 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
spotifyActions: bindActionCreators(spotifyActions, dispatch),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(LibraryPlaylists);
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(LibraryPlaylists);
|
||||
|
||||
Reference in New Issue
Block a user