Cleaning up header and filter alignment

This commit is contained in:
James Barnsley
2019-10-09 09:42:20 +13:00
parent fe6ace5c62
commit 61d2939372
21 changed files with 7758 additions and 149 deletions

View File

@ -18,7 +18,7 @@ import * as mopidyActions from '../../services/mopidy/actions';
import * as spotifyActions from '../../services/spotify/actions';
import * as googleActions from '../../services/google/actions';
class LibraryArtists extends React.Component {
class LibraryArtists extends React.Component {
constructor(props) {
super(props);
@ -29,7 +29,7 @@ class LibraryArtists 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) {
@ -56,7 +56,7 @@ class LibraryArtists extends React.Component {
}
componentWillReceiveProps(newProps) {
if (newProps.mopidy_connected && (newProps.source == 'all' || newProps.source == 'local')) {
if (newProps.mopidy_connected && (newProps.source == 'all' || newProps.source == 'local')) {
// We've just connected
if (!this.props.mopidy_connected) {
this.props.mopidyActions.getLibraryArtists();
@ -68,7 +68,7 @@ class LibraryArtists extends React.Component {
}
}
if (newProps.mopidy_connected && newProps.google_enabled && (newProps.source == 'all' || newProps.source == 'google')) {
if (newProps.mopidy_connected && newProps.google_enabled && (newProps.source == 'all' || newProps.source == 'google')) {
// We've just been enabled (or detected as such)
if (!this.props.google_enabled) {
this.props.googleActions.getLibraryArtists();
@ -80,7 +80,7 @@ class LibraryArtists 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_artists_status != 'finished' && newProps.spotify_library_artists_status != 'started') {
this.props.spotifyActions.getLibraryArtists();
@ -125,7 +125,7 @@ class LibraryArtists extends React.Component {
// Mopidy library items
if (this.props.mopidy_library_artists && (this.props.source == 'all' || this.props.source == 'local')) {
for (uri of this.props.mopidy_library_artists) {
for (uri of this.props.mopidy_library_artists) {
// Construct item placeholder. This is used as Mopidy needs to
// lookup ref objects to get the full object which can take some time
var source = helpers.uriSource(uri);
@ -144,7 +144,7 @@ class LibraryArtists extends React.Component {
// Google library items
if (this.props.google_library_artists && (this.props.source == 'all' || this.props.source == 'google')) {
for (uri of this.props.google_library_artists) {
for (uri of this.props.google_library_artists) {
// Construct item placeholder. This is used as Mopidy needs to
// lookup ref objects to get the full object which can take some time
var source = helpers.uriSource(uri);
@ -193,12 +193,12 @@ class LibraryArtists extends React.Component {
details={['followers']}
middle_column={['source']}
className="artists"
link_prefix="/artist/"
link_prefix="/artist/"
/>
<LazyLoadListener
loadKey={total_artists > this.state.limit ? this.state.limit : total_artists}
showLoader={this.state.limit < total_artists}
loadMore={() => this.loadMore()}
loadMore={() => this.loadMore()}
/>
</section>
);
@ -207,15 +207,15 @@ class LibraryArtists extends React.Component {
<section className="content-wrapper">
<ArtistGrid
handleContextMenu={(e, item) => this.handleContextMenu(e, item)}
artists={artists}
artists={artists}
/>
<LazyLoadListener
loadKey={total_artists > this.state.limit ? this.state.limit : total_artists}
showLoader={this.state.limit < total_artists}
loadMore={() => this.loadMore()}
loadMore={() => this.loadMore()}
/>
</section>
);
);
}
render() {
@ -278,7 +278,8 @@ class LibraryArtists extends React.Component {
<span>
<FilterField
initialValue={this.state.filter}
handleChange={(value) => this.setState({ filter: value, limit: this.state.per_page })}
handleChange={(value) => this.setState({ filter: value, limit: this.state.per_page })}
onSubmit={e => this.props.uiActions.hideContextMenu()}
/>
<DropdownField
icon="sort"
@ -286,21 +287,21 @@ class LibraryArtists 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_artists_view: value }); this.props.uiActions.hideContextMenu(); }}
handleChange={(value) => { this.props.uiActions.set({ library_artists_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_artists_source: value }); this.props.uiActions.hideContextMenu(); }}
handleChange={(value) => { this.props.uiActions.set({ library_artists_source: value }); this.props.uiActions.hideContextMenu(); }}
/>
</span>
);
@ -347,4 +348,4 @@ const mapDispatchToProps = (dispatch) => ({
googleActions: bindActionCreators(googleActions, dispatch),
});
export default connect(mapStateToProps, mapDispatchToProps)(LibraryArtists);
export default connect(mapStateToProps, mapDispatchToProps)(LibraryArtists);