Adding numbers to loader

This commit is contained in:
James Barnsley
2020-12-05 21:41:30 +13:00
parent 491735c901
commit 094bdfeab8
15 changed files with 173 additions and 129 deletions

View File

@ -195,7 +195,7 @@ class LibraryAlbums extends React.Component {
} = this.state;
let { albums } = this.props;
if (loading_progress !== null) {
if (loading_progress) {
return <Loader body loading progress={loading_progress} />;
}
@ -261,7 +261,6 @@ class LibraryAlbums extends React.Component {
filter,
per_page,
} = this.state;
const loading = loading_progress !== null;
const source_options = [
{
@ -361,11 +360,11 @@ class LibraryAlbums extends React.Component {
<Button
noHover
discrete
onClick={loading ? this.cancelRefresh : this.refresh}
onClick={loading_progress ? this.cancelRefresh : this.refresh}
tracking={{ category: 'LibraryAlbums', action: 'Refresh' }}
>
{loading ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
{loading_progress ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading_progress ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
</Button>
</>
);

View File

@ -171,8 +171,10 @@ class LibraryArtists extends React.Component {
} = this.state;
let { artists } = this.props;
if (loading_progress !== null) {
return <Loader body loading progress={loading_progress} />;
if (loading_progress) {
return (
<Loader body loading progress={loading_progress} />
);
}
if (sort) {
@ -228,7 +230,6 @@ class LibraryArtists extends React.Component {
google_available,
loading_progress,
} = this.props;
const loading = loading_progress !== null;
const source_options = [
{
@ -320,11 +321,11 @@ class LibraryArtists extends React.Component {
<Button
noHover
discrete
onClick={loading ? this.cancelRefresh : this.refresh}
onClick={loading_progress ? this.cancelRefresh : this.refresh}
tracking={{ category: 'LibraryArtists', action: 'Refresh' }}
>
{loading ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
{loading_progress ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading_progress ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
</Button>
</>
);

View File

@ -158,7 +158,7 @@ class LibraryPlaylists extends React.Component {
limit,
} = this.state;
if (loading_progress !== null) {
if (loading_progress) {
return <Loader body loading progress={loading_progress} />;
}
let playlists = [...playlistsProp];
@ -224,7 +224,6 @@ class LibraryPlaylists extends React.Component {
const {
filter,
} = this.state;
const loading = loading_progress !== null;
const source_options = [
{
@ -321,11 +320,11 @@ class LibraryPlaylists extends React.Component {
<Button
noHover
discrete
onClick={loading ? this.cancelRefresh : this.refresh}
onClick={loading_progress ? this.cancelRefresh : this.refresh}
tracking={{ category: 'LibraryAlbums', action: 'Refresh' }}
>
{loading ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
{loading_progress ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading_progress ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
</Button>
<Button
to="/playlist/create"

View File

@ -201,7 +201,7 @@ class LibraryTracks extends React.Component {
} = this.state;
let { tracks } = this.props;
if (loading_progress !== null) {
if (loading_progress) {
return <Loader body loading progress={loading_progress} />;
}
@ -244,7 +244,6 @@ class LibraryTracks extends React.Component {
filter,
per_page,
} = this.state;
const loading = loading_progress !== null;
const source_options = [
{
@ -319,11 +318,11 @@ class LibraryTracks extends React.Component {
<Button
noHover
discrete
onClick={loading ? this.cancelRefresh : this.refresh}
onClick={loading_progress ? this.cancelRefresh : this.refresh}
tracking={{ category: 'LibraryTracks', action: 'Refresh' }}
>
{loading ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
{loading_progress ? <Icon name="close" /> : <Icon name="refresh" /> }
{loading_progress ? <I18n path="actions.cancel" /> : <I18n path="actions.refresh" /> }
</Button>
</>
);

View File

@ -71,7 +71,7 @@ class AddToPlaylist extends React.Component {
loading_progress,
} = this.props;
if (loading_progress !== null) {
if (loading_progress) {
return <Loader body loading progress={loading_progress} />;
}