Service worker caching, Loader component

This commit is contained in:
James Barnsley
2019-09-10 06:59:44 +12:00
parent a86403fa59
commit c08cc71c47
49 changed files with 16390 additions and 11259 deletions

View File

@ -10,7 +10,7 @@ import FollowButton from '../components/Fields/FollowButton';
import LazyLoadListener from '../components/LazyLoadListener';
import Parallax from '../components/Parallax';
import NiceNumber from '../components/NiceNumber';
import ContextMenuTrigger from '../components/ContextMenuTrigger';
import Loader from '../components/Loader';
import Icon from '../components/Icon';
import * as helpers from '../helpers';
@ -19,7 +19,7 @@ import * as uiActions from '../services/ui/actions';
import * as mopidyActions from '../services/mopidy/actions';
import * as spotifyActions from '../services/spotify/actions';
class User extends React.Component {
class User extends React.Component {
constructor(props) {
super(props);
}
@ -70,21 +70,17 @@ class User extends React.Component {
if (!this.props.user) {
if (helpers.isLoading(this.props.load_queue, [`spotify_users/${user_id}`, `spotify_users/${user_id}/playlists/?`])) {
return (
<div className="body-loader loading">
<div className="loader" />
</div>
);
return <Loader body loading />
}
return (
<ErrorMessage type="not-found" title="Not found">
<p>
Could not find user with URI "
{encodeURIComponent(this.props.uri)}
"
<p>
Could not find user with URI "
{encodeURIComponent(this.props.uri)}
"
</p>
</ErrorMessage>
);
);
}
const user = helpers.collate(this.props.user, { playlists: this.props.playlists });
@ -117,19 +113,19 @@ Could not find user with URI "
<h2>
<ul className="details">
{!this.props.slim_mode ? <li className="source"><Icon type="fontawesome" name={helpers.sourceIcon(user.uri)} /></li> : null}
{user.playlists_total ? (
<li>
<NiceNumber value={user.playlists_total} />
{' '}
playlists
</li>
{user.playlists_total ? (
<li>
<NiceNumber value={user.playlists_total} />
{' '}
playlists
</li>
) : null}
{user.followers ? (
<li>
<NiceNumber value={user.followers} />
{' '}
followers
</li>
{user.followers ? (
<li>
<NiceNumber value={user.followers} />
{' '}
followers
</li>
) : null}
{this.isMe() ? <li><span className="blue-text">You</span></li> : null}
</ul>
@ -147,7 +143,7 @@ followers
<LazyLoadListener
loadKey={user.playlists_more}
showLoader={user.playlists_more}
loadMore={() => this.loadMore()}
loadMore={() => this.loadMore()}
/>
</section>
</div>